KeyboardInterrupt eats my error and then won't be caught

greg greg at cosc.canterbury.ac.nz
Sat Jun 20 22:21:23 EDT 2009


Philip Semanchuk wrote:

> Best of all, PyErr_CheckSignals() doesn't interfere with a Python- level 
> signal handler if one is set.

Ah, I hadn't realised that you were doing this in C
code, and I was trying to think of a Python-level
solution.

For C code, the solution you give sounds like a
good one.

My only misgiving is that the user might expect to
get a KeyboardInterrupt in response to Ctrl-C, so
it might be better to just let it propagate instead
of turning it into a different exception.

-- 
Greg



More information about the Python-list mailing list