Get the latest tech news

Is it safe to call print in a Python signal handler?


We learned earlier that because Python has two signal handlers, the onerous restrictions on what functions a signal handler may call do not apply to Python, because CPython does not call the user-supplied Python signal handler inside the low-level C signal handler, where those restrictions do apply, but arranges for it to be called later, when the interpreter is in a consistent state. We also learned that Python signal handlers are unexpectedly reentrant – if a signal arrives while a Python signal handler is running, the signal handler can be called again in the middle of the first call.

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Print

Print

Related news:

News photo

Print with dozens of colors: Our new open-source ColorMix for PrusaSlicer

News photo

Apple Hoping to 3D-Print More Products

News photo

Harvard engineers 3D-print soft robots that bend, twist, grasp, and move on command