summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2015-03-10 12:47:41 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2015-03-10 12:47:41 (GMT)
commit55f1949225b58e7a7b80617f2fc4fd890e3a9844 (patch)
treed1912e23759cc2c206c4deeb5ca1d974d5834a16
parent80f6bb4cd85c88fc24a4d183c7c236f97ac3eb2f (diff)
parent77a6b20a3590f58b6f715eec7f099360c5dba516 (diff)
downloadcpython-55f1949225b58e7a7b80617f2fc4fd890e3a9844.zip
cpython-55f1949225b58e7a7b80617f2fc4fd890e3a9844.tar.gz
cpython-55f1949225b58e7a7b80617f2fc4fd890e3a9844.tar.bz2
Issue #23432: Remove duplicate content from SystemExit docs.
Also, document SystemExit.code attribute explicitly.
-rw-r--r--Doc/library/exceptions.rst26
1 files changed, 13 insertions, 13 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index 5892154..271a5c8 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -353,18 +353,17 @@ The following exceptions are the exceptions that are usually raised.
.. exception:: SystemExit
- This exception is raised by the :func:`sys.exit` function. When it is not
- handled, the Python interpreter exits; no stack traceback is printed. If the
- associated value is an integer, it specifies the system exit status (passed
- to C's :c:func:`exit` function); if it is ``None``, the exit status is zero;
- if it has another type (such as a string), the object's value is printed and
+ This exception is raised by the :func:`sys.exit` function. It inherits from
+ :exc:`BaseException` instead of :exc:`Exception` so that it is not accidentally
+ caught by code that catches :exc:`Exception`. This allows the exception to
+ properly propagate up and cause the interpreter to exit. When it is not
+ handled, the Python interpreter exits; no stack traceback is printed. The
+ constructor accepts the same optional argument passed to :func:`sys.exit`.
+ If the value is an integer, it specifies the system exit status (passed to
+ C's :c:func:`exit` function); if it is ``None``, the exit status is zero; if
+ it has another type (such as a string), the object's value is printed and
the exit status is one.
- Instances have an attribute :attr:`!code` which is set to the proposed exit
- status or error message (defaulting to ``None``). Also, this exception derives
- directly from :exc:`BaseException` and not :exc:`Exception`, since it is not
- technically an error.
-
A call to :func:`sys.exit` is translated into an exception so that clean-up
handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be
executed, and so that a debugger can execute a script without running the risk
@@ -372,9 +371,10 @@ The following exceptions are the exceptions that are usually raised.
absolutely positively necessary to exit immediately (for example, in the child
process after a call to :func:`os.fork`).
- The exception inherits from :exc:`BaseException` instead of :exc:`Exception` so
- that it is not accidentally caught by code that catches :exc:`Exception`. This
- allows the exception to properly propagate up and cause the interpreter to exit.
+ .. attribute:: code
+
+ The exit status or error message that is passed to the constructor.
+ (Defaults to ``None``.)
.. exception:: TypeError