A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-September/136172.html below:

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

[Python-Dev] RFC: PEP 475, Retry system calls failing with EINTRVictor Stinner victor.stinner at gmail.com
Tue Sep 2 23:35:28 CEST 2014
2014-09-02 23:02 GMT+02:00 Matthew Woodcraft <matthew at woodcraft.me.uk>:
> 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.

Victor
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4