Message244037
> 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 ;) |
|
Date |
User |
Action |
Args |
2015-05-25 14:03:24 | pitrou | set | recipients:
+ pitrou, vstinner, Devin Jeanpierre |
2015-05-25 14:03:24 | pitrou | set | messageid: <1432562604.44.0.312126764964.issue24283@psf.upfronthosting.co.za> |
2015-05-25 14:03:24 | pitrou | link | issue24283 messages |
2015-05-25 14:03:24 | pitrou | create | |
|