summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_signal.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-29 20:32:47 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-29 20:32:47 (GMT)
commit1db9e7bb19909ed56821b1580cbb024faccac041 (patch)
tree20043197ec08844340c9ac039fe26c630bd4189d /Lib/test/test_signal.py
parent6aa4269ed25f7fdddd99fe1d7b09b8406ecb05ea (diff)
downloadcpython-1db9e7bb19909ed56821b1580cbb024faccac041.zip
cpython-1db9e7bb19909ed56821b1580cbb024faccac041.tar.gz
cpython-1db9e7bb19909ed56821b1580cbb024faccac041.tar.bz2
Issue #22054: Add os.get_blocking() and os.set_blocking() functions to get and
set the blocking mode of a file descriptor (False if the O_NONBLOCK flag is set, True otherwise). These functions are not available on Windows.
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r--Lib/test/test_signal.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index ca571b9..caca0be 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -276,7 +276,6 @@ class WakeupSignalTests(unittest.TestCase):
# use a subprocess to have only one thread
code = """if 1:
import _testcapi
- import fcntl
import os
import signal
import struct
@@ -299,10 +298,7 @@ class WakeupSignalTests(unittest.TestCase):
signal.signal(signal.SIGALRM, handler)
read, write = os.pipe()
- for fd in (read, write):
- flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0)
- flags = flags | os.O_NONBLOCK
- fcntl.fcntl(fd, fcntl.F_SETFL, flags)
+ os.set_blocking(write, False)
signal.set_wakeup_fd(write)
test()
@@ -322,7 +318,6 @@ class WakeupSignalTests(unittest.TestCase):
code = """if 1:
import _testcapi
import errno
- import fcntl
import os
import signal
import sys
@@ -333,8 +328,7 @@ class WakeupSignalTests(unittest.TestCase):
signal.signal(signal.SIGALRM, handler)
r, w = os.pipe()
- flags = fcntl.fcntl(r, fcntl.F_GETFL, 0)
- fcntl.fcntl(r, fcntl.F_SETFL, flags | os.O_NONBLOCK)
+ os.set_blocking(r, False)
# Set wakeup_fd a read-only file descriptor to trigger the error
signal.set_wakeup_fd(r)