[Python-checkins] cpython (merge 3.3 -> default): Remove the subprocess "bad exception data" warning (formerly a print!)

gregory.p.smith python-checkins at python.org
Sun Nov 11 09:09:01 CET 2012


http://hg.python.org/cpython/rev/44e5b48998ef
changeset:   80378:44e5b48998ef
parent:      80375:9180fb4eccc7
parent:      80377:2cc7e3f9cd35
user:        Gregory P. Smith <greg at krypto.org>
date:        Sun Nov 11 00:08:45 2012 -0800
summary:
  Remove the subprocess "bad exception data" warning (formerly a print!)
all together and just include the repr of the data in the exception
itself instead of the useless string "Unknown".

This code path is unlikely to even be possible to take given the
nature of the pipe it gets subprocess data from.

files:
  Lib/subprocess.py |  5 ++---
  Misc/NEWS         |  3 +++
  2 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/Lib/subprocess.py b/Lib/subprocess.py
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1412,11 +1412,10 @@
                     exception_name, hex_errno, err_msg = (
                             errpipe_data.split(b':', 2))
                 except ValueError:
-                    warnings.warn(RuntimeWarning(
-                            'Bad exception data: %r' % errpipe_data))
                     exception_name = b'SubprocessError'
                     hex_errno = b'0'
-                    err_msg = b'Unknown'
+                    err_msg = (b'Bad exception data from child: ' +
+                               repr(errpipe_data))
                 child_exception_type = getattr(
                         builtins, exception_name.decode('ascii'),
                         SubprocessError)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -116,6 +116,9 @@
 Library
 -------
 
+- Remove a bare print to stdout from the subprocess module that could have
+  happened if the child process wrote garbage to its pre-exec error pipe.
+
 - The subprocess module now raises its own SubprocessError instead of a
   RuntimeError in various error situations which should not normally happen.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list