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

2020-03-09 Thread STINNER Victor


STINNER Victor  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2016-01-08 Thread Martin Panter

Martin Panter added the comment:

But sys.stdin.buffer would be a BufferedReader

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2016-01-08 Thread Марк Коренберг

Марк Коренберг added the comment:

sys.stdin
sys.stdout
sys.stderr
...
These streams are regular text files
...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2016-01-08 Thread Марк Коренберг

Марк Коренберг added the comment:

16.2.4.3. Multi-threading
FileIO objects are thread-safe to the extent that the operating system calls 
(such as read(2) under Unix) they wrap are thread-safe too.

Binary buffered objects (instances of BufferedReader, BufferedWriter, 
BufferedRandom and BufferedRWPair) protect their internal structures using a 
lock; it is therefore safe to call them from multiple threads at once.

 TextIOWrapper objects are not thread-safe. 


Maybe problem here?

--
nosy: +mmarkk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com