[Checkins] [zopefoundation/Zope] 743581: Fix final Py3 test failure. (#143)
GitHub
noreply at github.com
Wed May 31 23:50:08 CEST 2017
Branch: refs/heads/master
Home: https://github.com/zopefoundation/Zope
Commit: 743581ac181290e0e91b99e9a711075858fe8ce4
https://github.com/zopefoundation/Zope/commit/743581ac181290e0e91b99e9a711075858fe8ce4
Author: Hanno Schlichting <hanno at hannosch.eu>
Date: 2017-05-31 (Wed, 31 May 2017)
Changed paths:
M src/ZPublisher/HTTPRequest.py
M src/ZPublisher/tests/testHTTPRequest.py
Log Message:
-----------
Fix final Py3 test failure. (#143)
Fix final Py3 test failure.
This is a combination of three fixes. The tests had to be adjusted, as
the cgi module in Python 3 won't work without a content-length header
anymore. This is a side-effect of python/cpython at 5c23b8e6ea7cdb0002842d16dbce4b4d716dd35a.
Without the content length, the limit / read_bytes calculation is off,
and we end up with three fieldstorage instances each with an empty byte,
rather than one instance with a content of `test\n`.
The second part is a heavy handed workaround for closing the BytesIO
instance underlying the FieldStorage too early. In Python 2.7, there
wasn't a `__del__` defined yet. There's a good chance, a proper fix
could also be related to http://bugs.python.org/issue23700 and
http://bugs.python.org/issue18879, but I couldn't work out if
something similar was indeed the issue here.
Finally the TemporaryFileWrapper no longer needs special closing/del
logic under Python 3, as the implementation changed. There is no
`close_called` attribute anymore, but rather a more complex `_closer`
indirection.
More information about the checkins
mailing list