The bufsize argument to Popen() should accept None meaning the default (0).
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 @@
_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 @@
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
#