2014-09-02 23:02 GMT+02:00 Matthew Woodcraft firstname.lastname@example.org:
I think people who use sleep() in their programs could benefit from not having to worry about EINTR as much as anyone else.
The behaviour of time.sleep() is worse than what I expected. On UNIX, if select() fails with EINTR, time.sleep() calls PyErr_CheckSignals(). If the signal handler doesn't raise an exception, time.sleep() returns None and just simply ignores the error.
But on Windows, it's the opposite. If time.sleep() is interrupt by CTRL+c, time.sleep() raises an InterruptedError...
Good luck to write portable code :-p
With the PEP 475, time.sleep(secs) now has a well defined behaviour. It sleeps at least "secs" seconds, retry the syscall on EINTR, and raises an exception if the signal handler raises an exception.