]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-12029: [doc] clarify that except does not match virtual subclasses of the specifi...
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Mon, 21 Mar 2022 21:22:39 +0000 (21:22 +0000)
committerGitHub <noreply@github.com>
Mon, 21 Mar 2022 21:22:39 +0000 (21:22 +0000)
(cherry picked from commit 45833b50f0ccf2abb01304c900afee05b6d01b9e)

Doc/reference/compound_stmts.rst
Doc/reference/executionmodel.rst

index 7f37bb4fdf9c999352bc1711fb36a6329a8bec4b..871c101996b155e9dd22526ea3c5a1ecb2288c66 100644 (file)
@@ -233,9 +233,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 it 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.  [#]_
index e652915bd271c375e3767b06abb16ae9c1d34758..d9183561820b2beedbb200068775e3862bab9f0a 100644 (file)
@@ -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::