]> granicus.if.org Git - python/commitdiff
Remove the subprocess "bad exception data" warning (formerly a print!)
authorGregory P. Smith <greg@krypto.org>
Sun, 11 Nov 2012 08:08:45 +0000 (00:08 -0800)
committerGregory P. Smith <greg@krypto.org>
Sun, 11 Nov 2012 08:08:45 +0000 (00:08 -0800)
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.

1  2 
Lib/subprocess.py
Misc/NEWS

index d52f9a45f3986bba246c599bf7a636cbe9bbed07,dad7b1670d085a1eecc198df30167e9ab5ba651c..0fff36fa5d67763f395ee12b983c0faf6828dcac
@@@ -1412,14 -1412,13 +1412,13 @@@ class Popen(object)
                      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'RuntimeError'
 +                    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'),
 -                        RuntimeError)
 +                        SubprocessError)
                  for fd in (p2cwrite, c2pread, errread):
                      if fd != -1:
                          os.close(fd)
diff --cc Misc/NEWS
index 30e32173683b410eb2de6682ed2f3e64e7f284f6,cd923b371e05b0edd82468ce46afd70ff4aa915a..ba474d8d2bbbc759439e68171456d2965e078766
+++ b/Misc/NEWS
@@@ -116,9 -83,9 +116,12 @@@ Core and Builtin
  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.
 +
  - Issue #16327: The subprocess module no longer leaks file descriptors
    used for stdin/stdout/stderr pipes to the child when fork() fails.