Message167694
Popen.communicate() raises an exception if passed no input when stdin=PIPE and universal_newlines=True. With universal_newlines=False, no exception is raised. For example, the following yields--
args = [sys.executable, '-c', 'pass']
popen = Popen(args, universal_newlines=False, stdin=PIPE, stdout=PIPE, stderr=PIPE)
print(popen.communicate())
popen = Popen(args, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
print(popen.communicate())
(b'', b'[41449 refs]\n')
Traceback (most recent call last):
...
File ".../Lib/subprocess.py", line 1581, in _communicate_with_poll
self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'NoneType' object has no attribute 'encode'
It seems like communicate() should not be trying to encode input if there is none.
I can provide a patch with tests if it is agreed this is an issue (along with a fix assuming it is reasonable). |
|
Date |
User |
Action |
Args |
2012-08-08 16:38:00 | chris.jerdonek | set | recipients:
+ chris.jerdonek |
2012-08-08 16:38:00 | chris.jerdonek | set | messageid: <1344443880.03.0.234384317121.issue15592@psf.upfronthosting.co.za> |
2012-08-08 16:37:59 | chris.jerdonek | link | issue15592 messages |
2012-08-08 16:37:57 | chris.jerdonek | create | |
|