[Python-checkins] cpython (3.3): Issue #17835: Fix test_io when the default OS pipe buffer size is larger than
antoine.pitrou
python-checkins at python.org
Wed Apr 24 23:38:32 CEST 2013
http://hg.python.org/cpython/rev/4b4ed1e11fd0
changeset: 83517:4b4ed1e11fd0
branch: 3.3
parent: 83512:601570064725
user: Antoine Pitrou <solipsis at pitrou.net>
date: Wed Apr 24 23:31:38 2013 +0200
summary:
Issue #17835: Fix test_io when the default OS pipe buffer size is larger than one million bytes.
files:
Lib/test/support.py | 10 ++++++----
Lib/test/test_io.py | 4 ++--
Misc/NEWS | 3 +++
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/Lib/test/support.py b/Lib/test/support.py
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -573,10 +573,12 @@
IPV6_ENABLED = _is_ipv6_enabled()
-# A constant likely larger than the underlying OS pipe buffer size.
-# Windows limit seems to be around 512B, and many Unix kernels have a 64K pipe
-# buffer size or 16*PAGE_SIZE: take a few megs to be sure. This
-PIPE_MAX_SIZE = 3 * 1000 * 1000
+# A constant likely larger than the underlying OS pipe buffer size, to
+# make writes blocking.
+# Windows limit seems to be around 512 B, and many Unix kernels have a
+# 64 KiB pipe buffer size or 16 * PAGE_SIZE: take a few megs to be sure.
+# (see issue #17835 for a discussion of this number).
+PIPE_MAX_SIZE = 4 *1024 * 1024 + 1
# decorator for skipping tests on non-IEEE 754 platforms
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
@@ -3061,7 +3061,7 @@
# The buffered IO layer must check for pending signal
# handlers, which in this case will invoke alarm_interrupt().
self.assertRaises(ZeroDivisionError,
- wio.write, item * (support.PIPE_MAX_SIZE // len(item)))
+ wio.write, item * (support.PIPE_MAX_SIZE // len(item) + 1))
t.join()
# We got one byte, get another one and check that it isn't a
# repeat of the first one.
@@ -3160,7 +3160,7 @@
select = support.import_module("select")
# A quantity that exceeds the buffer size of an anonymous pipe's
# write end.
- N = 1024 * 1024
+ N = support.PIPE_MAX_SIZE
r, w = os.pipe()
fdopen_kwargs["closefd"] = False
# We need a separate thread to read from the pipe and allow the
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -132,6 +132,9 @@
Tests
-----
+- Issue #17835: Fix test_io when the default OS pipe buffer size is larger
+ than one million bytes.
+
- Issue #17065: Use process-unique key for winreg tests to avoid failures if
test is run multiple times in parallel (eg: on a buildbot host).
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list