Roundup Tracker - Issues


Author rouilj
Recipients ezio.melotti, joseph_myers, rouilj
Date 2019-06-09.01:23:25
Message-id <>
I have committed rev5775:17e110426ad7 preserving the super call.

The diff is:

diff -r 765f8c0e99ef -r 17e110426ad7 roundup/cgi/
--- a/roundup/cgi/     Fri Jun 07 21:53:55 2019 -0400
+++ b/roundup/cgi/     Sat Jun 08 21:10:39 2019 -0400
@@ -230,7 +230,8 @@
         if set_cookie:
             self.client.add_cookie(self.cookie_name, self._sid, 
-class BinaryFieldStorage(cgi.FieldStorage):
+# import from object as well so it's a new style object and I can use 
+class BinaryFieldStorage(cgi.FieldStorage, object):
     '''This class works around the bug
        cgi.FieldStorage must save all data as binary/bytes. This is
@@ -243,7 +244,7 @@
         import tempfile
         if self.length >= 0:
             return tempfile.TemporaryFile("wb+")
-        return super().make_file()
+        return super(BinaryFieldStorage, self).make_file()
 class Client:
     """Instantiate to handle one CGI request.

I arrived at this thanks to modifying an example from Ezio.
I have attached the modified example as

There were three ways to handle this:

  1) make sure super is never called on python 2 using the 'or ...'
     clause Joseph initially suggested. Workable but seemed like it
     wasn't in the python spirit.

  2) Use my suggested rewrite to call the base class directly. Joseph
     was correct that it shouldn't be:

         return cgi.FieldStorage().make_file()

     Ezio produced an earlier version of that showed the 
     call should be:

                 return cgi.FieldStorage().make_file(self)

    which addresses Joseph's issue if I were to go this way.

  3) The patch above which is also shown in makes
     BinaryFieldStorage inherit from object as well which makes
     super() when called using python2 and python 3 compatible
     semantics as super(BaseFieldStorage, self).... work. when run under py2 and py3 produces:


showing that super works as expected in this case.

I still can't figure out how to trigger this test case by calling
Client. But I am able to trigger both code paths manually using binary
and text data.


-- rouilj
Date User Action Args
2019-06-09 01:23:26rouiljsetmessageid: <>
2019-06-09 01:23:26rouiljsetrecipients: + rouilj, ezio.melotti, joseph_myers
2019-06-09 01:23:26rouiljlinkissue2551046 messages
2019-06-09 01:23:25rouiljcreate