[Python-3000-checkins] r55815 - in python/branches/py3k-struni/Lib: subprocess.py test/test_subprocess.py
guido.van.rossum
python-3000-checkins at python.org
Thu Jun 7 23:56:49 CEST 2007
Author: guido.van.rossum
Date: Thu Jun 7 23:56:45 2007
New Revision: 55815
Modified:
python/branches/py3k-struni/Lib/subprocess.py
python/branches/py3k-struni/Lib/test/test_subprocess.py
Log:
The bufsize argument to Popen() should accept None meaning the default (0).
Modified: python/branches/py3k-struni/Lib/subprocess.py
==============================================================================
--- python/branches/py3k-struni/Lib/subprocess.py (original)
+++ python/branches/py3k-struni/Lib/subprocess.py Thu Jun 7 23:56:45 2007
@@ -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")
Modified: python/branches/py3k-struni/Lib/test/test_subprocess.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_subprocess.py (original)
+++ python/branches/py3k-struni/Lib/test/test_subprocess.py Thu Jun 7 23:56:45 2007
@@ -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
#
More information about the Python-3000-checkins
mailing list