Kaydet (Commit) 46a05a7d authored tarafından Guido van Rossum's avatar Guido van Rossum

The bufsize argument to Popen() should accept None meaning the default (0).

üst ad5b9de2
...@@ -465,6 +465,8 @@ class Popen(object): ...@@ -465,6 +465,8 @@ class Popen(object):
_cleanup() _cleanup()
self._child_created = False self._child_created = False
if bufsize is None:
bufsize = 0 # Restore default
if not isinstance(bufsize, int): if not isinstance(bufsize, int):
raise TypeError("bufsize must be an integer") raise TypeError("bufsize must be an integer")
......
...@@ -455,6 +455,14 @@ class ProcessTestCase(unittest.TestCase): ...@@ -455,6 +455,14 @@ class ProcessTestCase(unittest.TestCase):
else: else:
self.fail("Expected TypeError") 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 # POSIX tests
# #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment