summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-06-07 21:56:45 (GMT)
committerGuido van Rossum <guido@python.org>2007-06-07 21:56:45 (GMT)
commit46a05a7db5a65ebee04a43e0394672a72b37ffa1 (patch)
tree9b341cb102776b9f2656f25163781bcc92a92640 /Lib
parentad5b9de288de6b5f965fdfd4db30753c30f9d5ca (diff)
downloadcpython-46a05a7db5a65ebee04a43e0394672a72b37ffa1.zip
cpython-46a05a7db5a65ebee04a43e0394672a72b37ffa1.tar.gz
cpython-46a05a7db5a65ebee04a43e0394672a72b37ffa1.tar.bz2
The bufsize argument to Popen() should accept None meaning the default (0).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/subprocess.py2
-rw-r--r--Lib/test/test_subprocess.py8
2 files changed, 10 insertions, 0 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 051f2d4..1ae7426 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -465,6 +465,8 @@ class Popen(object):
_cleanup()
self._child_created = False
+ if bufsize is None:
+ bufsize = 0 # Restore default
if not isinstance(bufsize, int):
raise TypeError("bufsize must be an integer")
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index ec004bf..b44e83a 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -455,6 +455,14 @@ class ProcessTestCase(unittest.TestCase):
else:
self.fail("Expected TypeError")
+ def test_bufsize_is_none(self):
+ # bufsize=None should be the same as bufsize=0.
+ p = subprocess.Popen([sys.executable, "-c", "pass"], None)
+ self.assertEqual(p.wait(), 0)
+ # Again with keyword arg
+ p = subprocess.Popen([sys.executable, "-c", "pass"], bufsize=None)
+ self.assertEqual(p.wait(), 0)
+
#
# POSIX tests
#