[issue26037] Crash when reading sys.stdin.buffer in a daemon thread

STINNER Victor report at bugs.python.org
Mon Mar 9 07:18:22 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

The problem is that Py_FinalizeEx() tries to close the sys.stdin object in _PyImport_Cleanup(), but closing the buffered object requires the object lock which is hold by _thread(). _thread() is blocked on waiting for a newline character.

I suggest to use non-blocking read in a loop, to be able to properly stop your thread at Python exit. You may want to give a try using the asyncio module.

Python works as expected. I don't see any bug here. I close the issue.

----------
nosy: +vstinner
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue26037>
_______________________________________


More information about the Python-bugs-list mailing list