summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-11-11 07:33:56 (GMT)
committerGregory P. Smith <greg@krypto.org>2012-11-11 07:33:56 (GMT)
commit1f83866ecd07cf1b06f630c24a9092d3449955f6 (patch)
treeead299264c8a30d422e79b1d98bf5b2d7bf2e89d /Lib
parent561cbc4e7bdf457bb64acf8ef7e5358795816c88 (diff)
parentf44c9da16655395f57d3686cb4d82b651489a974 (diff)
downloadcpython-1f83866ecd07cf1b06f630c24a9092d3449955f6.zip
cpython-1f83866ecd07cf1b06f630c24a9092d3449955f6.tar.gz
cpython-1f83866ecd07cf1b06f630c24a9092d3449955f6.tar.bz2
Rename a local variable for readability and change a "this can't
happen" print() call into a RuntimeWarning as it should've been in the first place. Because nothing should ever cause unexpected stdout output.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/subprocess.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 02c722b..db0ba19 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1392,26 +1392,28 @@ class Popen(object):
# Wait for exec to fail or succeed; possibly raising an
# exception (limited in size)
- data = bytearray()
+ errpipe_data = bytearray()
while True:
part = _eintr_retry_call(os.read, errpipe_read, 50000)
- data += part
- if not part or len(data) > 50000:
+ errpipe_data += part
+ if not part or len(errpipe_data) > 50000:
break
finally:
# be sure the FD is closed no matter what
os.close(errpipe_read)
- if data:
+ if errpipe_data:
try:
_eintr_retry_call(os.waitpid, self.pid, 0)
except OSError as e:
if e.errno != errno.ECHILD:
raise
try:
- exception_name, hex_errno, err_msg = data.split(b':', 2)
+ exception_name, hex_errno, err_msg = (
+ errpipe_data.split(b':', 2))
except ValueError:
- print('Bad exception data:', repr(data))
+ warnings.warn(RuntimeWarning(
+ 'Bad exception data: %r' % errpipe_data))
exception_name = b'RuntimeError'
hex_errno = b'0'
err_msg = b'Unknown'