]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34130: Fix test_signal.test_socket() (GH-8326)
authorVictor Stinner <vstinner@redhat.com>
Wed, 18 Jul 2018 15:43:57 +0000 (17:43 +0200)
committerGitHub <noreply@github.com>
Wed, 18 Jul 2018 15:43:57 +0000 (17:43 +0200)
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.

Lib/test/test_signal.py

index 354c3fde168c32e265f8c86e4d8696bb00515751..e69db79909cc9795ba23884d9d7366806762be54 100644 (file)
@@ -392,7 +392,6 @@ class WakeupSocketSignalTests(unittest.TestCase):
         signal.signal(signum, handler)
 
         read, write = socket.socketpair()
-        read.setblocking(False)
         write.setblocking(False)
         signal.set_wakeup_fd(write.fileno())