Message6536
Hi Joseph:
Yup it looks like you are correct its' a super mispmatch between
py2 and py3.
The form of the super() call isn't python 2 compatible.
Also it looks like the cgi.FieldStorage class under python2
is an old style class. So Ezio's suggestion of changing
it to:
python2 you need to use super(SubClass, self), on python3
super() is enough, but super(SubClass, self) is also accepted
doesn't work either as super(BinaryFieldStorage, self) throws:
File "roundup/cgi/client.py", line 246, in make_file
return super(BinaryFieldStorage,self).make_file()
TypeError: super() argument 1 must be type, not classobj
Your suggestion to check python version does work, but it seems
icky.
Since there is only single inheritance on the class, I changed it to use:
class BinaryFieldStorage(cgi.FieldStorage):
def make_file(self, mode=None):
import tempfile
if self.length >= 0:
return tempfile.TemporaryFile("wb+")
return cgi.FieldStorage().make_file()
This seems to work in manual testing with both p3 and p2.
Do you know of any reason it wouldn't work?
Also there are a number of places where super(Subclass,self) is
being called. Do you know if any of those were touched
with the python 3 patches? If so they need to be audited and
invoked by tests to make sure we don't have old style class issues.
Unless codecov already reports they are covered.
Also I guess somebody has to figure out how to test this patch
and the other super calls too.
Sigh.
-- rouilj |
|
Date |
User |
Action |
Args |
2019-06-07 15:20:42 | rouilj | set | messageid: <1559920842.36.0.424993110134.issue2551046@roundup.psfhosted.org> |
2019-06-07 15:20:42 | rouilj | set | recipients:
+ rouilj, ezio.melotti, joseph_myers |
2019-06-07 15:20:42 | rouilj | link | issue2551046 messages |
2019-06-07 15:20:42 | rouilj | create | |
|