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 detected and an error is raised. If instead we 
allowed the IO call to continue, all sorts of problems could ensue (data loss, 
crashes...).

So, indeed, print() is not safe in signal handlers. Though the fact that it 
raises an exception, rather than crashes, makes things easier for the developer 
;)

----------
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24283>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to