Signal-handling question

Gary Robinson grobinson at
Wed Jul 2 21:41:48 CEST 2003

In some code we're writing we're making an assumption, and I'd like to
confirm that the assumption is valid.

Suppose a signal arrives while a file is being written, and the signal
handler explicitly raises a SystemExit exception.

My understanding is that the C-level I/O code will continue and the signal
won't be processed until the end of the atomic python interpreter
instruction that invoked that C code.

Then, the signal handler is executed, including the SystemExit.

Are we guaranteed that there are no circumstances under which any more file
I/O will be carried out by the interrupted code after the signal handler is
invoked? That is, are we guaranteed that the SystemExit raised by the signal
handler will immediately terminate the interrupted call to write()?

The answer seems to be "obviously YES" but I need to be sure so I thought it
was worth asking.



Putting in your email helps it pass through
overzealous spam filters.

Gary Robinson
Transpose, LLC
grobinson at

More information about the Python-list mailing list