Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue23646

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:PEP 475: handle EINTR in the time module, retry sleep()
Type:Stage:
Components:Versions:Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: neologix, pitrou, python-dev, vstinner
Priority:normalKeywords:patch

Created on2015-03-12 15:37 byvstinner, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
sleep_eintr.patchvstinner,2015-03-12 15:37review
sleep.pyvstinner,2015-03-12 15:38
sleep_eintr-2.patchvstinner,2015-03-12 15:45review
Messages (11)
msg237948 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-03-12 15:37
Attached patch changes time.sleep() to retry select() when select() is interrupted by a signal or retry WaitForSingleObjectEx() when the signal SIGINT is received on Windows.The patch drops support for EMX, sorry! I didn't know EMX, I had to Google it: "EMX is a free 32-bit DOS extender which adds some properties of Unix to MS-compatible DOS and IBM's OS/2 operating systems." (OS/2 support was dropped in Python 3.4  by thePEP 11.)The patch also drops support for Watcom C compiler. I guess that it's also something specific to MS-DOS or very old (and unsupported) Windows versions.select.select() is available on all platforms according to the doc, so I don't understand why we would not use it on all platforms for time.sleep() in 2015!https://docs.python.org/dev/library/select.html#select.select
msg237949 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-03-12 15:38
The patch includes a unit test for POSIX.For Windows, you can test manually using the attached sleep.py program: press CTRL+c to send SIGINT signals.
msg237952 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-03-12 15:45
Oh, test_signal fails with the patch because time.sleep() is not interrupted by a signal. New patch.I also reverted #ifdef order in floatsleep() to have a patch easier to review.
msg237953 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-03-12 15:46
Note: test_signal will have to be modified again when select will also retry on EINTR :-) See issue#23485. For example, test_signal.test_wakeup_fd_early() can register a signal handler which raises an exception and catch InterruptedError.
msg237959 -(view)Author: Charles-François Natali (neologix)*(Python committer)Date: 2015-03-12 16:35
As for the change to select/poll/etc, IIRC Guido was opposed to it,that's why I didn't update them.
msg237983 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-03-12 20:27
Le jeudi 12 mars 2015, Charles-François Natali <report@bugs.python.org> aécrit :>> As for the change to select/poll/etc, IIRC Guido was opposed to it,> that's why I didn't update them.>Wait what? can you elaborate? I'm not aware of that.
msg238269 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-03-17 09:50
New changeset4accc35cbfcf by Victor Stinner in branch 'default':Revert changesetd927047b1d8eb87738676980a24930d053ba2150https://hg.python.org/cpython/rev/4accc35cbfcf
msg238270 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-03-17 09:52
I commited sleep_eintr.patch by mistake. After this change, test_socket started to fail on Windows. I don't understand why.http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/5836/steps/test/logs/stdio======================================================================ERROR: testClose (test.test_socket.TCPCloserTest)----------------------------------------------------------------------Traceback (most recent call last):  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_socket.py", line 3723, in testClose    read, write, err = select.select([sd], [], [], 1.0)TypeError: argument must be an int, or have a fileno() method.======================================================================FAIL: testRecv (test.test_socket.NonBlockingTCPTests)----------------------------------------------------------------------Traceback (most recent call last):  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_socket.py", line 3883, in testRecv    self.fail("Error trying to do non-blocking recv.")AssertionError: Error trying to do non-blocking recv.
msg238557 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-03-19 20:59
New changesetb1abd06465fc by Victor Stinner in branch 'default':Issue#23646: If time.sleep() is interrupted by a signal, the sleep is nowhttps://hg.python.org/cpython/rev/b1abd06465fc
msg238594 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-03-20 01:01
New changeset9882cc2efd36 by Victor Stinner in branch 'default':Issue#23646: Enhance precision of time.sleep() and socket timeout whenhttps://hg.python.org/cpython/rev/9882cc2efd36
msg238599 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-03-20 02:06
New changeset1291649f38df by Victor Stinner in branch 'default':Issue#23646: Fix test_threading on Windowshttps://hg.python.org/cpython/rev/1291649f38df
History
DateUserActionArgs
2022-04-11 14:58:13adminsetgithub: 67834
2015-03-20 02:06:25python-devsetmessages: +msg238599
2015-03-20 01:01:59python-devsetmessages: +msg238594
2015-03-19 23:00:18vstinnersetstatus: open -> closed
resolution: fixed
2015-03-19 20:59:59python-devsetmessages: +msg238557
2015-03-17 09:52:08vstinnersetmessages: +msg238270
2015-03-17 09:50:12python-devsetnosy: +python-dev
messages: +msg238269
2015-03-12 20:27:58vstinnersetmessages: +msg237983
2015-03-12 16:35:18neologixsetmessages: +msg237959
2015-03-12 15:51:50vstinnerlinkissue23648 dependencies
2015-03-12 15:46:36vstinnersetmessages: +msg237953
2015-03-12 15:45:09vstinnersetfiles: +sleep_eintr-2.patch

messages: +msg237952
2015-03-12 15:38:31vstinnersetfiles: +sleep.py

messages: +msg237949
2015-03-12 15:37:42vstinnercreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp