This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: PEP 475: port test_eintr to Windows
Type: Stage: resolved
Components: Tests, Windows Versions: Python 3.5
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: jpe, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2015-03-20 12:09 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
win32-sleep-test.diff jpe, 2015-04-14 01:28 review
Messages (4)
msg238652 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-03-20 12:09
Currently, test_eintr is complelty skipped on Windows. time.sleep() was also patched on Windows to retry when interrupted by a signal (issue #23646) and I was able to see a different when testing manually.

test_eintr is currently implemented with signal.setitimer() and os.fork(). Windows doesn't have signal.setitimer(), signal.alarm(), nor os.fork(), but it's possible to send a signal to another process using os.kill() (by the way, see the issue #14484 "missing return in win32_kill?").

At least, time.sleep() should be tested on Windows.
msg240823 - (view) Author: John Ehresman (jpe) * Date: 2015-04-14 01:28
Here's the 1st draft of a test for interrupts during time.sleep().  It creates a thread to generate the ctrl-c events which seems to work well (note that kill() on win32 is quite limited in terms of sending events to other processes).  The creation and use of the subthread probably could be improved.  I also needed to add a way of specifying creationflags for a subprocess so a new console could be created; otherwise the parent test process is also interrupted by the ctrl-c.

I have not tested the modified test on a non-win32 platform
msg249631 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-09-03 11:14
The change ed0e6a9c11af replaced os.fork() with subprocess to try to fix race conditions in test_eintr (the test sometimes hangs on FreeBSD buildbots). os.fork() is not available on Windows, so this change should help to port test_eintr to Windows.

About win32-sleep-test.diff: I'm not sure that it's a good idea to introduce a new thread in test_eintr. Signal handlers is more complex when we have multiple threads. Would it be possible to spawn a new process which will send a signal every N seconds to its parent?
msg306873 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-24 01:32
Sorry, I lost track of this idea, and I was unable to review win32-sleep-test.diff :-( While it would be "nice to have", the code is well tested on Unix. I close the issue.
Date User Action Args
2022-04-11 14:58:14adminsetgithub: 67907
2017-11-24 01:32:23vstinnersetstatus: open -> closed
resolution: out of date
messages: + msg306873

stage: resolved
2016-02-12 05:21:10ned.deilyunlinkissue26279 superseder
2016-02-12 05:19:15ned.deilylinkissue26279 superseder
2015-09-03 11:14:04vstinnersetmessages: + msg249631
2015-05-25 22:55:42vstinnerunlinkissue23648 dependencies
2015-04-14 01:28:44jpesetfiles: + win32-sleep-test.diff

nosy: + jpe
messages: + msg240823

keywords: + patch
2015-03-20 12:10:19vstinnerlinkissue23648 dependencies
2015-03-20 12:09:59vstinnersetnosy: + tim.golden, zach.ware, steve.dower
components: + Tests, Windows
2015-03-20 12:09:51vstinnercreate