Message302040
> 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. |
|
Date |
User |
Action |
Args |
2017-09-13 09:30:22 | vstinner | set | recipients:
+ vstinner, pitrou, serhiy.storchaka, Oren Milman |
2017-09-13 09:30:22 | vstinner | set | messageid: <1505295022.69.0.470158479021.issue31444@psf.upfronthosting.co.za> |
2017-09-13 09:30:22 | vstinner | link | issue31444 messages |
2017-09-13 09:30:22 | vstinner | create | |
|