[issue15267] tempfile.TemporaryFile and httplib incompatibility

Serhiy Storchaka report at bugs.python.org
Sat May 16 18:07:44 CEST 2015


Serhiy Storchaka added the comment:

Catching TypeError or AttributeError on len() is a hack, but it is compatible with Python 3 and older code. We could handle this in issue23740.

Changing TemporaryFile would solve this issue, but only for TemporaryFile. len() raises AttributeError for other file-like classic classes. So I committed slightly modified Atsuo's patch (extended test as Victor suggested).

As for converting classic classes to new-style classes, see for example issue14399. It is not so harmless, as expected, unfortunately. But perhaps it was done multiple times in bug-fix releases.

----------
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15267>
_______________________________________


More information about the Python-bugs-list mailing list