summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-06-24 07:23:47 (GMT)
committerGregory P. Smith <greg@krypto.org>2012-06-24 07:23:47 (GMT)
commit990a5feba77de7fc5fd5ad5a16f61dc93667f63e (patch)
treeb0fdb65c20e4a233f59a60c4aa2081949a9cf441 /Lib/test/test_io.py
parent80d440aee198abc4077f7c30ecbf0a14e42c6eea (diff)
parent5135992164f4c0df8d18d3b486431b28214db16b (diff)
downloadcpython-990a5feba77de7fc5fd5ad5a16f61dc93667f63e.zip
cpython-990a5feba77de7fc5fd5ad5a16f61dc93667f63e.tar.gz
cpython-990a5feba77de7fc5fd5ad5a16f61dc93667f63e.tar.bz2
Fixes issue #12268: File readline, readlines and read() or readall() methods
no longer lose data when an underlying read system call is interrupted. IOError is no longer raised due to a read system call returning EINTR from within these methods.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 54ba179..dfc7c69 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -2912,7 +2912,7 @@ class SignalsTest(unittest.TestCase):
try:
wio = self.io.open(w, **fdopen_kwargs)
t.start()
- signal.alarm(1)
+ signal.setitimer(signal.ITIMER_REAL, 0.1)
# Fill the pipe enough that the write will be blocking.
# It will be interrupted by the timer armed above. Since the
# other thread has read one byte, the low-level write will
@@ -2957,7 +2957,7 @@ class SignalsTest(unittest.TestCase):
r, w = os.pipe()
wio = self.io.open(w, **fdopen_kwargs)
try:
- signal.alarm(1)
+ signal.setitimer(signal.ITIMER_REAL, 0.1)
# Either the reentrant call to wio.write() fails with RuntimeError,
# or the signal handler raises ZeroDivisionError.
with self.assertRaises((ZeroDivisionError, RuntimeError)) as cm:
@@ -2992,7 +2992,7 @@ class SignalsTest(unittest.TestCase):
try:
rio = self.io.open(r, **fdopen_kwargs)
os.write(w, b"foo")
- signal.alarm(1)
+ signal.setitimer(signal.ITIMER_REAL, 0.1)
# Expected behaviour:
# - first raw read() returns partial b"foo"
# - second raw read() returns EINTR
@@ -3036,13 +3036,13 @@ class SignalsTest(unittest.TestCase):
t.daemon = True
def alarm1(sig, frame):
signal.signal(signal.SIGALRM, alarm2)
- signal.alarm(1)
+ signal.setitimer(signal.ITIMER_REAL, 0.1)
def alarm2(sig, frame):
t.start()
signal.signal(signal.SIGALRM, alarm1)
try:
wio = self.io.open(w, **fdopen_kwargs)
- signal.alarm(1)
+ signal.setitimer(signal.ITIMER_REAL, 0.1)
# Expected behaviour:
# - first raw write() is partial (because of the limited pipe buffer
# and the first alarm)