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 vstinner
Recipients Oren Milman, pitrou, serhiy.storchaka, vstinner
Date 2017-09-13.09:30:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505295022.69.0.470158479021.issue31444@psf.upfronthosting.co.za>
In-reply-to
Content
> this is because _Py_DisplaySourceLine() (in Python/traceback.c) assumes that io.TextIOWrapper() returned a stream object, and tries to call its close()  method. in case calling close() fails, _Py_DisplaySourceLine() just calls PyErr_Clear().

I consider that _Py_DisplaySourceLine() is right to expect that io.TextIOWrapper() creates a stream object. If the TextIOWrapper creation fails, it calls binary.close() to prevent a resource warning. Here your function doesn't fail but returns None which is really not expected.


> def _bad_TextIOWrapper(*args): return None
> io.TextIOWrapper = _bad_TextIOWrapper

I don't see why Python should support such strange TextIOWrapper type. I simply suggest to close the issue as WONTFIX.
History
Date User Action Args
2017-09-13 09:30:22vstinnersetrecipients: + vstinner, pitrou, serhiy.storchaka, Oren Milman
2017-09-13 09:30:22vstinnersetmessageid: <1505295022.69.0.470158479021.issue31444@psf.upfronthosting.co.za>
2017-09-13 09:30:22vstinnerlinkissue31444 messages
2017-09-13 09:30:22vstinnercreate