[issue24283] Print not safe in signal handlers

2015-05-25 Thread Devin Jeanpierre
New submission from Devin Jeanpierre: The code attached runs a while loop that prints, and has a signal handler that also prints. There is a thread that constantly fires off signals, but this is just to ensure the condition for the bug happens -- this is a bug with signal handling, not

[issue24283] Print not safe in signal handlers

2015-05-25 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24283 ___ ___ Python-bugs-list

[issue24283] Print not safe in signal handlers

2015-05-25 Thread Antoine Pitrou
Antoine Pitrou added the comment: RuntimeError: reentrant call inside _io.BufferedWriter name='stdout' As the exception message suggests: the IO stack is not reentrant. If an ongoing IO call is interrupted by a signal, and the signal handler calls again into the IO stack, this situation is

[issue24283] Print not safe in signal handlers

2015-05-25 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: It doesn't do any of those things in Python 2, to my knowledge. Why aren't we willing to make this work? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24283

[issue24283] Print not safe in signal handlers

2015-05-25 Thread STINNER Victor
STINNER Victor added the comment: It doesn't do any of those things in Python 2, to my knowledge. Well, even if Python 2 doesn't warn you, threading_print_test.py is also wrong on Python 2. Python 3 is better because it warns you :-) Why aren't we willing to make this work? It would be