[Python-Dev] pthread sem PyThread_acquire_lock

"Martin v. Löwis" martin at v.loewis.de
Mon Jun 29 23:28:07 CEST 2009


> AFAIK, ignoring EINTR doesn't preclude the calling of signal handlers.

This is my understanding as well - so I don't think Python actually
"swallows" the signal.

> A great example is reading from a socket. Whether or not it can be
> interrupted depends on the platform, so catching Ctrl+C often requires
> a timeout loop.
> 
> Also, remember that signals are asynchronous in the sense that they
> are handled outside the normal execution flow of a program. Checking
> for EINTR probably isn't the best way to determine if a signal has
> been sent to the program.

I think it would be reasonable to support "asynchronous" exceptions,
and Python supports SIGINT fairly well most of the time.

It might be possible to support keyboard interrupts throughout
the system, but changing Python to do so could also cause
incompatibilities. So any change must be done with greatest care,
but simultaneously, should also try to arrange to cover all cases.

Regards,
Martin


More information about the Python-Dev mailing list