
Hi, At the end of August, I sent the PEP 475 which I wrote with Charles-François Natali: https://mail.python.org/pipermail/python-dev/2014-August/136077.html https://mail.python.org/pipermail/python-dev/2014-September/136101.html Antoine Pitrou wrote " I'm +1 on the whole PEP" and R. David Murray wrote "Personally, I really want Python to handle EINTR for me". What's the next step? Who wants to handle this PEP? Guido? Antoine? I will try to answer to questions if previous answers were not enough. Antoine Pitrou wrote:
I modified signal.set_wakeup_fd() in Python 3.5 to support a socket on Windows. So it becomes possible to support signals with signal.set_wakeup_fd() on Windows (for SelectorEventLoop and ProactorEventLoop): https://code.google.com/p/tulip/issues/detail?id=191 Antoine Pitrou wrote:
In Python 3.4, os.read() is dummy: it only calls the C function read() once. With the PEP 475, read() is only called again on EINTR if the signal handler did not raise an exception. When read() returns EINTR, there is "partial read", the read did not start yet. So I don't understand what should be added to the PEP. There is no specific change. Matthew Woodcraft wrote:
In Python 3.4, signal.signal() calls siginterrupt(signum, True): syscalls raise InterruptedError when interrupted by a signal. Calling explicitly signal.siginterrupt(signum, True) doesn't change anything. In Python 3.4, signal.siginterrupt(signum, False) reduces the cases when InterruptedError is raised, but they are still cases when InterruptedError is raised. The exact behaviour probably depends on the operating system or even the version of the operating system. It's better to not rely on siginterrupt(False) to write portable code in Python 3.4. With the PEP, signal.siginterrupt(signum, False) is still supported. The PEP doesn't change the behaviour when the syscall is directly restarted by the C library. If the function returns EINTR, the interrupted syscall is retried if the signal handler didn't raise an exception. The main problem of siginterrupt(False) is that the Python signal handler is *not* called if the C library directly retries the interrupted syscall. Note: if signals are blocked, the C signal handlers are not called, so the PEP doesn't change the behaviour neither. Victor wrote:
I think that the stdlib should not handle InterruptedError exception anymore in the Python code, to simplify the code.
I modified the PEP to mention that: https://hg.python.org/peps/rev/627fefe0394f Victor

Oh, I forgot the link to the PEP: http://legacy.python.org/dev/peps/pep-0475/ Victor

2014-10-28 22:36 GMT+01:00 Antoine Pitrou <solipsis@pitrou.net>:
Is there an implementation somewhere?
There is no implementation yet. This time, I chose to focus on the PEP before working on an implementation :-) We can work on the implementation if it helps discuss the PEP. I created a repository 3 months ago, but it has no commit yet: https://hg.python.org/features/eintr/ The issue contains a first patch: http://bugs.python.org/issue18885 Antoine wrote:
(I can handle the PEP if Guido doesn't want to and other people agree)
Guido just wrote:
I would be okay if Antoine agrees to be the PEP-BDFL.
Victor

Oh, I forgot the link to the PEP: http://legacy.python.org/dev/peps/pep-0475/ Victor

2014-10-28 22:36 GMT+01:00 Antoine Pitrou <solipsis@pitrou.net>:
Is there an implementation somewhere?
There is no implementation yet. This time, I chose to focus on the PEP before working on an implementation :-) We can work on the implementation if it helps discuss the PEP. I created a repository 3 months ago, but it has no commit yet: https://hg.python.org/features/eintr/ The issue contains a first patch: http://bugs.python.org/issue18885 Antoine wrote:
(I can handle the PEP if Guido doesn't want to and other people agree)
Guido just wrote:
I would be okay if Antoine agrees to be the PEP-BDFL.
Victor
participants (3)
-
Antoine Pitrou
-
Guido van Rossum
-
Victor Stinner