Post #3424515
2026-06-27 08:59 UTC
tl;dr - hitting Ctrl-C at any point in any Python program can produce undefined behavior.
Feeling better about not landing that Python job every day.
"Most notably, a KeyboardInterrupt may appear at any point during execution. Most Python code, including the standard library, cannot be made robust against this, and so a KeyboardInterrupt (or any other exception resulting from a signal handler) may on rare occasions put the program in an unexpected state."
- https://docs.python.org/3/library/signal.html#note-on-signal-handlers-and-exceptions
Replies (1)
-
@RueNahcMohr@infosec.exchange 2026-06-27 09:03
@penryu@hachyderm.io wtf people, if its an interrupt the main code should not even notice. ...what?...