diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2022-03-21 20:41:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-21 20:41:35 (GMT) |
commit | 45833b50f0ccf2abb01304c900afee05b6d01b9e (patch) | |
tree | 52845aefc3e49e87f943ece45aef00c0f99c4be3 /Doc | |
parent | 1ea055bd53ccf976e88018983a3c13447c4502be (diff) | |
download | cpython-45833b50f0ccf2abb01304c900afee05b6d01b9e.zip cpython-45833b50f0ccf2abb01304c900afee05b6d01b9e.tar.gz cpython-45833b50f0ccf2abb01304c900afee05b6d01b9e.tar.bz2 |
bpo-12029: [doc] clarify that except does not match virtual subclasses of the specified exception type (GH-32027)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/reference/compound_stmts.rst | 7 | ||||
-rw-r--r-- | Doc/reference/executionmodel.rst | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 15a51e7..92024e5 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -243,9 +243,10 @@ is found that matches the exception. An expression-less except clause, if present, must be last; it matches any exception. For an except clause with an expression, that expression is evaluated, and the clause matches the exception if the resulting object is "compatible" with the exception. An object is -compatible with an exception if the object is the class or a base class of the exception -object, or a tuple containing an item that is the class or a base class of -the exception object. +compatible with an exception if the object is the class or a +:term:`non-virtual base class <abstract base class>` of the exception object, +or a tuple containing an item that is the class or a non-virtual base class +of the exception object. If no except clause matches the exception, the search for an exception handler continues in the surrounding code and on the invocation stack. [#]_ diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst index e652915..d918356 100644 --- a/Doc/reference/executionmodel.rst +++ b/Doc/reference/executionmodel.rst @@ -259,8 +259,9 @@ a stack traceback, except when the exception is :exc:`SystemExit`. Exceptions are identified by class instances. The :keyword:`except` clause is selected depending on the class of the instance: it must reference the class of -the instance or a base class thereof. The instance can be received by the -handler and can carry additional information about the exceptional condition. +the instance or a :term:`non-virtual base class <abstract base class>` thereof. +The instance can be received by the handler and can carry additional information +about the exceptional condition. .. note:: |