[Python-checkins] bpo-34130: Fix test_signal.test_socket() (GH-8326) (GH-8330)

Victor Stinner webhook-mailer at python.org
Wed Jul 18 13:02:10 EDT 2018


https://github.com/python/cpython/commit/e13180bc4c40a9ac300590c62a6efbcaf10ae6df
commit: e13180bc4c40a9ac300590c62a6efbcaf10ae6df
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Victor Stinner <vstinner at redhat.com>
date: 2018-07-18T19:02:06+02:00
summary:

bpo-34130: Fix test_signal.test_socket() (GH-8326) (GH-8330)

test_signal.test_socket(): On Windows, sometimes even if the C signal handler
succeed to write the signal number into the write end of the socketpair, the
test fails with a BlockingIOError on the non-blocking read.recv(1) because the
read end of the socketpair didn't receive the byte yet.

Fix the race condition on Windows by setting the read end as blocking.
(cherry picked from commit 99bb6df66a42625367c4f38e6802c8bb527baf4a)

Co-authored-by: Victor Stinner <vstinner at redhat.com>

files:
M Lib/test/test_signal.py

diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 8d6386793d4a..5565eb745caf 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -370,7 +370,6 @@ def handler(signum, frame):
         signal.signal(signum, handler)
 
         read, write = socket.socketpair()
-        read.setblocking(False)
         write.setblocking(False)
         signal.set_wakeup_fd(write.fileno())
 



More information about the Python-checkins mailing list