Issue 1071755: raise error for common mistake with subprocess (original) (raw)

subprocess has a very easy to mistake error in it - forgetting to pass the command as a list. Eg

import subprocess subprocess.call("ls") BaseHTTPServer.py dummy_threading.py pickletools.py socket.py Bastion.py email pipes.py
sre.py [...] dummy_thread.py pickle.pyc sndhdr.py
zipfile.py 0 subprocess.call("ls", "-l") BaseHTTPServer.py dummy_threading.py pickletools.py socket.py Bastion.py email pipes.py
sre.py [...] dummy_thread.py pickle.pyc sndhdr.py
zipfile.py 0

Note no error, warning or anything, but no "ls -l" either

And with the patch...

subprocess.call("ls", "-l") Traceback (most recent call last): File "", line 1, in ? File "subprocess.py", line 428, in call return Popen(*args, **kwargs).wait() File "subprocess.py", line 508, in init raise TypeError("bufsize must be an integer - " TypeError: bufsize must be an integer - did you forget to pass your arguments in a list?