summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2021-04-11 08:33:59 (GMT)
committerGitHub <noreply@github.com>2021-04-11 08:33:59 (GMT)
commit79650d0118b0a8861428b9dd063089de405cf137 (patch)
tree48bcdfb1d6209d5ac2c120c523bf0d3e84aaddcf /Doc
parentdfb45323ce8a543ca844c311e32c994ec9554c1b (diff)
downloadcpython-79650d0118b0a8861428b9dd063089de405cf137.zip
cpython-79650d0118b0a8861428b9dd063089de405cf137.tar.gz
cpython-79650d0118b0a8861428b9dd063089de405cf137.tar.bz2
Fix description of behaviour of an exception class in 'from' clause (GH-24303)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/reference/simple_stmts.rst11
1 files changed, 7 insertions, 4 deletions
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index 3fff848..941b342 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -591,10 +591,13 @@ instance, with its traceback set to its argument), like so::
__context__ (exception attribute)
The ``from`` clause is used for exception chaining: if given, the second
-*expression* must be another exception class or instance, which will then be
-attached to the raised exception as the :attr:`__cause__` attribute (which is
-writable). If the raised exception is not handled, both exceptions will be
-printed::
+*expression* must be another exception class or instance. If the second
+expression is an exception instance, it will be attached to the raised
+exception as the :attr:`__cause__` attribute (which is writable). If the
+expression is an exception class, the class will be instantiated and the
+resulting exception instance will be attached to the raised exception as the
+:attr:`__cause__` attribute. If the raised exception is not handled, both
+exceptions will be printed::
>>> try:
... print(1 / 0)