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 <[email protected]> <http://bugs.python.org/issue15267> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
