[issue2551046] Attempts to attach file or create large message fail under python2

John Rouillard <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
New submission from John Rouillard:

Hi Joseph,

Sorry to bother you but I bisected the code and it looks like the 
commit rev5671:f60c44563c3a makes image file uploads and large (967 
works, 1303 fails) messages fail when running under python2:

====
changeset:   5671:f60c44563c3a
user:        Joseph Myers <[email protected]>
date:        Sun Mar 24 21:49:17 2019 +0000
files:       roundup/cgi/client.py
description:
Adjust make_file override to use binary files only when needed.

Previous version would produce errors for large text fields in form
submissions with Python 3, so inherit from the default make_file
implementation and only force binary files in the specific case
(self.length >= 0) identified in <https://bugs.python.org/issue27777>.
====

So it looks like this error is now happening under python2 post commit.

Running python2 demo.py nuke and attaching a file or adding a largish 
message while creating a new issue (or adding to an existing issue) 
causes the following crash:

EXCEPTION AT Fri Jun  7 01:26:07 2019
Traceback (most recent call last):
  File "roundup.hg/roundup/scripts/roundup_server.py", line 222, in 
run_cgi
    self.inner_run_cgi()
  File "roundup.hg/roundup/scripts/roundup_server.py", line 459, in 
inner_run_cgi
    tracker.Client(tracker, self, env).main()
  File "roundup.hg/roundup/cgi/client.py", line 395, in __init__
    self.form = BinaryFieldStorage(fp=request.rfile, environ=env)
  File "/usr/lib/python2.7/cgi.py", line 507, in __init__
    self.read_multi(environ, keep_blank_values, strict_parsing)
  File "/usr/lib/python2.7/cgi.py", line 636, in read_multi
    environ, keep_blank_values, strict_parsing)
  File "/usr/lib/python2.7/cgi.py", line 509, in __init__
    self.read_single()
  File "/usr/lib/python2.7/cgi.py", line 646, in read_single
    self.read_lines()
  File "/usr/lib/python2.7/cgi.py", line 668, in read_lines
    self.read_lines_to_outerboundary()
  File "/usr/lib/python2.7/cgi.py", line 728, in 
read_lines_to_outerboundary
    self.__write(odelim + line)
  File "/usr/lib/python2.7/cgi.py", line 675, in __write
    self.file = self.make_file('')
  File "roundup.hg/roundup/cgi/client.py", line 246, in make_file
    return super().make_file()
TypeError: super() takes at least 1 argument (0 given)

Not sure what to do here. Should it be super().make_file(self)?

At the very least it looks like we have no test for this code path.

Ideas?

----------
assignee: joseph_myers
components: Web interface
keywords: Blocker, python2
messages: 6531
nosy: rouilj
priority: high
severity: urgent
status: new
title: Attempts to attach file or create large message fail under python2
type: crash
versions: devel

_________________________________________________
Roundup tracker <[email protected]>
<https://issues.roundup-tracker.org/issue2551046>
_________________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.