[Python-Dev] RFC: PEP 475, Retry system calls failing with EINTR

R. David Murray rdmurray at bitdance.com
Mon Sep 1 17:47:07 CEST 2014

On Mon, 01 Sep 2014 14:15:52 +0300, Marko Rauhamaa <marko at pacujo.net> wrote:
> Charles-François Natali <cf.natali at gmail.com>:
> >> Which raises an interesting question: what happens to the os.read()
> >> return value if SIGINT is received?
> >
> > There's no return value, a KeywordInterrupt exception is raised.
> > The PEP wouldn't change this behavior.
> Slightly disconcerting... but I'm sure overriding SIGINT would cure
> that. You don't want to lose data if you want to continue running.
> > As for the general behavior: all programming languages/platforms
> > handle EINTR transparently.
> C doesn't. EINTR is there for a purpose. I sure hope Python won't bury
> it under opaque APIs.
> The two requirements are:
>  * Allow the application to react to signals immediately in the main
>    flow.

You don't want to be writing your code in Python then.  In Python
you *never* get to react immediately to signals.  The interpreter
sets a flag and calls the python signal handler later.  Yes, the
call is ASAP, but ASAP is *not* "immediately".

>  * Don't lose information.
> Marko
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/rdmurray%40bitdance.com

More information about the Python-Dev mailing list