Raise TypeError if bufsize argument is not an integer. Patch 1071755, slightly modified.
This commit is contained in:
parent
6fdf3cbb13
commit
738131d391
|
@ -504,6 +504,9 @@ class Popen(object):
|
|||
"""Create new Popen instance."""
|
||||
_cleanup()
|
||||
|
||||
if not isinstance(bufsize, (int, long)):
|
||||
raise TypeError("bufsize must be an integer")
|
||||
|
||||
if mswindows:
|
||||
if preexec_fn is not None:
|
||||
raise ValueError("preexec_fn is not supported on Windows "
|
||||
|
|
|
@ -394,6 +394,17 @@ class ProcessTestCase(unittest.TestCase):
|
|||
# Subsequent invocations should just return the returncode
|
||||
self.assertEqual(p.wait(), 0)
|
||||
|
||||
|
||||
def test_invalid_bufsize(self):
|
||||
# an invalid type of the bufsize argument should raise
|
||||
# TypeError.
|
||||
try:
|
||||
subprocess.Popen([sys.executable, "-c", "pass"], "orange")
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
self.fail("Expected TypeError")
|
||||
|
||||
#
|
||||
# POSIX tests
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue