[Checkins] [zopefoundation/Zope] 2c6568: Fix final Py3 test failure.
GitHub
noreply at github.com
Wed May 31 21:59:00 CEST 2017
Branch: refs/heads/py3-final
Home: https://github.com/zopefoundation/Zope
Commit: 2c6568a5722e92462b4c7fed24c3acfc0389b4fe
https://github.com/zopefoundation/Zope/commit/2c6568a5722e92462b4c7fed24c3acfc0389b4fe
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.
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