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

Victor Stinner victor.stinner at gmail.com
Mon Sep 1 00:36:36 CEST 2014

Le 1 sept. 2014 00:04, "Marko Rauhamaa" <marko at pacujo.net> a écrit :
> Victor Stinner <victor.stinner at gmail.com>:
> > But I don't get you point. How does this PEP make the situation worse?
> Did I say it would? I just wanted to make sure the system call
> resumption doesn't become mandatory.

The syscall is only retried on EINTR if the signal handler didn't raise an
exception. So it is not always retried:


If a system call fails with ``EINTR``, Python must call signalhandlers:
call ``PyErr_CheckSignals()``. If a signal handler raisesan exception, the
Python function fails with the exception.Otherwise, the system call is
retried.  If the system call takes atimeout parameter, the timeout is

> Haven't thought through what the exception raising technique would
> entail. It might be perfectly ok apart from being a change to the signal
> handler API.

I don't think that it is safe to expect an InterruptedError if the signal
handler doesn't raise an exception. Many Python module already retry the
syscall on EINTR.

So I'm not sure that the PEP is really a major change. It's just to make
Python more homogeneous, always have the same reliable and portable

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140901/6ec6bba6/attachment.html>

More information about the Python-Dev mailing list