[Python-checkins] cpython: Issue #23680: Reduce risk of race condition in check_interrupted_write() of
victor.stinner
python-checkins at python.org
Mon Mar 16 18:03:52 CET 2015
https://hg.python.org/cpython/rev/10acab2d4a88
changeset: 95009:10acab2d4a88
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Mar 16 18:03:06 2015 +0100
summary:
Issue #23680: Reduce risk of race condition in check_interrupted_write() of
test_io. Allocate the large data before scheduling an alarm in 1 second.
On very slow computer, the alarm rings sometimes during the memory allocation.
files:
Lib/test/test_io.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -3431,6 +3431,7 @@
t.daemon = True
r, w = os.pipe()
fdopen_kwargs["closefd"] = False
+ large_data = item * (support.PIPE_MAX_SIZE // len(item) + 1)
try:
wio = self.io.open(w, **fdopen_kwargs)
t.start()
@@ -3442,8 +3443,7 @@
# handlers, which in this case will invoke alarm_interrupt().
signal.alarm(1)
try:
- self.assertRaises(ZeroDivisionError,
- wio.write, item * (support.PIPE_MAX_SIZE // len(item) + 1))
+ self.assertRaises(ZeroDivisionError, wio.write, large_data)
finally:
signal.alarm(0)
t.join()
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list