mirror of
https://github.com/python/cpython.git
synced 2025-11-15 00:00:00 +00:00
#7590: exception classes no longer are in the "exceptions" module. Also clean up text that was written with string exceptions in mind.
This commit is contained in:
parent
e82ac51cd6
commit
fbd1b2203d
1 changed files with 5 additions and 13 deletions
|
|
@ -3,20 +3,12 @@
|
||||||
Built-in Exceptions
|
Built-in Exceptions
|
||||||
===================
|
===================
|
||||||
|
|
||||||
.. module:: exceptions
|
|
||||||
:synopsis: Standard exception classes.
|
|
||||||
|
|
||||||
|
|
||||||
Exceptions should be class objects. The exceptions are defined in the module
|
|
||||||
:mod:`exceptions`. This module never needs to be imported explicitly: the
|
|
||||||
exceptions are provided in the built-in namespace as well as the
|
|
||||||
:mod:`exceptions` module.
|
|
||||||
|
|
||||||
.. index::
|
.. index::
|
||||||
statement: try
|
statement: try
|
||||||
statement: except
|
statement: except
|
||||||
|
|
||||||
For class exceptions, in a :keyword:`try` statement with an :keyword:`except`
|
In Python, all exceptions must be instances of a class that derives from
|
||||||
|
:class:`BaseException`. In a :keyword:`try` statement with an :keyword:`except`
|
||||||
clause that mentions a particular class, that clause also handles any exception
|
clause that mentions a particular class, that clause also handles any exception
|
||||||
classes derived from that class (but not exception classes from which *it* is
|
classes derived from that class (but not exception classes from which *it* is
|
||||||
derived). Two exception classes that are not related via subclassing are never
|
derived). Two exception classes that are not related via subclassing are never
|
||||||
|
|
@ -44,7 +36,7 @@ programmers are encouraged to at least derive new exceptions from the
|
||||||
defining exceptions is available in the Python Tutorial under
|
defining exceptions is available in the Python Tutorial under
|
||||||
:ref:`tut-userexceptions`.
|
:ref:`tut-userexceptions`.
|
||||||
|
|
||||||
The following exceptions are only used as base classes for other exceptions.
|
The following exceptions are used mostly as base classes for other exceptions.
|
||||||
|
|
||||||
.. XXX document with_traceback()
|
.. XXX document with_traceback()
|
||||||
|
|
||||||
|
|
@ -99,8 +91,8 @@ The following exceptions are only used as base classes for other exceptions.
|
||||||
In this last case, :attr:`args` contains the verbatim constructor arguments as a
|
In this last case, :attr:`args` contains the verbatim constructor arguments as a
|
||||||
tuple.
|
tuple.
|
||||||
|
|
||||||
The following exceptions are the exceptions that are actually raised.
|
|
||||||
|
|
||||||
|
The following exceptions are the exceptions that are usually raised.
|
||||||
|
|
||||||
.. exception:: AssertionError
|
.. exception:: AssertionError
|
||||||
|
|
||||||
|
|
@ -369,10 +361,10 @@ The following exceptions are the exceptions that are actually raised.
|
||||||
associated value is a string indicating the type of the operands and the
|
associated value is a string indicating the type of the operands and the
|
||||||
operation.
|
operation.
|
||||||
|
|
||||||
|
|
||||||
The following exceptions are used as warning categories; see the :mod:`warnings`
|
The following exceptions are used as warning categories; see the :mod:`warnings`
|
||||||
module for more information.
|
module for more information.
|
||||||
|
|
||||||
|
|
||||||
.. exception:: Warning
|
.. exception:: Warning
|
||||||
|
|
||||||
Base class for warning categories.
|
Base class for warning categories.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue