This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Ramchandra Apte, demian.brecht, ishimoto, lemanyk1, martin.panter, orsenthil, python-dev, r.david.murray, serhiy.storchaka, tim.golden, tzs, vstinner
Date 2015-05-16.16:07:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1431792464.83.0.353325592508.issue15267@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-05-16 16:07:44serhiy.storchakasetrecipients: + serhiy.storchaka, ishimoto, orsenthil, vstinner, tim.golden, r.david.murray, python-dev, Ramchandra Apte, martin.panter, tzs, lemanyk1, demian.brecht
2015-05-16 16:07:44serhiy.storchakasetmessageid: <1431792464.83.0.353325592508.issue15267@psf.upfronthosting.co.za>
2015-05-16 16:07:44serhiy.storchakalinkissue15267 messages
2015-05-16 16:07:44serhiy.storchakacreate