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
     #
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to