Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cpython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
cpython
Commits
e09c6f54cb9f
Commit
e09c6f54cb9f
authored
4 years ago
by
Mark Dickinson
Browse files
Options
Downloads
Patches
Plain Diff
Fix description of behaviour of an exception class in 'from' clause (GH-24303)
parent
1ff5d074318e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Doc/reference/simple_stmts.rst
+7
-4
7 additions, 4 deletions
Doc/reference/simple_stmts.rst
with
7 additions
and
4 deletions
Doc/reference/simple_stmts.rst
+
7
−
4
View file @
e09c6f54
...
...
@@ -591,10 +591,13 @@
__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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment