[Python-checkins] cpython: Add a SubprocessError base class for exceptions in the subprocess module. (original) (raw)
gregory.p.smith python-checkins at python.org
Mon Mar 14 19:16:37 CET 2011
- Previous message: [Python-checkins] cpython: Attempt a larger timeout value to satisfy the buildbots.
- Next message: [Python-checkins] cpython (merge default -> default): merge default
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
http://hg.python.org/cpython/rev/d674b557600c changeset: 68463:d674b557600c parent: 68461:fd69e2f2cb72 user: Gregory P. Smith <greg at krypto.org> date: Mon Mar 14 14:08:43 2011 -0400 summary: Add a SubprocessError base class for exceptions in the subprocess module.
files: Doc/library/subprocess.rst Lib/subprocess.py
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -387,6 +387,11 @@
:func:call
and :meth:Popen.communicate
will raise :exc:TimeoutExpired
if
the timeout expires before the process exits.
+Exceptions defined in this module all inherit from :ext:SubprocessError
.
+
- .. versionadded:: 3.3
The :exc:`SubprocessError` base class was added.
Security ^^^^^^^^ diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -191,8 +191,10 @@
A ValueError will be raised if Popen is called with invalid arguments.
-check_call() and check_output() will raise CalledProcessError, if the -called process returns a non-zero return code. +Exceptions defined within this module inherit from SubprocessError. +check_call() and check_output() will raise CalledProcessError if the +called process returns a non-zero return code. TimeoutExpired +be raised if a timeout was specified and expired.
Security @@ -348,7 +350,10 @@ import warnings
Exception classes used by this module.
-class CalledProcessError(Exception): +class SubprocessError(Exception): pass + + +class CalledProcessError(SubprocessError): """This exception is raised when a process run by check_call() or check_output() returns a non-zero exit status. The exit status will be stored in the returncode attribute; @@ -362,7 +367,7 @@ return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
-class TimeoutExpired(Exception): +class TimeoutExpired(SubprocessError): """This exception is raised when the timeout expires while waiting for a child process. """
-- Repository URL: http://hg.python.org/cpython
- Previous message: [Python-checkins] cpython: Attempt a larger timeout value to satisfy the buildbots.
- Next message: [Python-checkins] cpython (merge default -> default): merge default
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]