Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
33d88a8d
Commit
33d88a8d
authored
Dec 08, 2012
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Plain Diff
Merge from 3.3 (Issue #15209)
parents
3c99d08a
2a818d27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
Doc/library/exceptions.rst
Doc/library/exceptions.rst
+17
-11
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/exceptions.rst
View file @
33d88a8d
...
@@ -39,17 +39,23 @@ When raising (or re-raising) an exception in an :keyword:`except` clause
...
@@ -39,17 +39,23 @@ When raising (or re-raising) an exception in an :keyword:`except` clause
new exception is not handled the traceback that is eventually displayed will
new exception is not handled the traceback that is eventually displayed will
include the originating exception(s) and the final exception.
include the originating exception(s) and the final exception.
This implicit exception chain can be made explicit by using :keyword:`from` with
When raising a new exception (rather than using to bare ``raise`` to re-raise
:keyword:`raise`. The single argument to :keyword:`from` must be an exception
the exception currently being handled), the implicit exception chain can be
or ``None``. It will be set as :attr:`__cause__` on the raised exception.
made explicit by using :keyword:`from` with :keyword:`raise`. The single
Setting :attr:`__cause__` implicitly sets the :attr:`__suppress_context__` to
argument to :keyword:`from` must be an exception or ``None``. It will be set
``True``. If :attr:`__cause__` is an exception, it will be displayed. If
as :attr:`__cause__` on the raised exception. Setting :attr:`__cause__`
:attr:`__cause__` is present or :attr:`__suppress_context__` has a true value,
also implicitly sets the :attr:`__suppress_context__` attribute to
:attr:`__context__` will not be displayed.
``True``.
In either case, the default exception handling code will not display any of the
The default traceback display code shows these chained exceptions in
remaining links in the :attr:`__context__` chain if :attr:`__cause__` has been
addition to the traceback for the exception itself. An explicitly chained
set.
exception in :attr:`__cause__` is always shown when present. An implicitly
chained exception in :attr:`__context__` is shown only if :attr:`__cause__`
is not set and :attr:`__suppress_context__` is false.
In either case, the exception itself is always shown after any chained
exceptions so that the final line of the traceback always shows the last
exception that was raised.
Base classes
Base classes
...
...
Misc/NEWS
View file @
33d88a8d
...
@@ -460,6 +460,9 @@ Build
...
@@ -460,6 +460,9 @@ Build
Documentation
Documentation
-------------
-------------
-
Issue
#
15209
:
Clarify
exception
chaining
description
in
exceptions
module
documentation
-
Issue
#
15990
:
Improve
argument
/
parameter
documentation
.
-
Issue
#
15990
:
Improve
argument
/
parameter
documentation
.
-
Issue
#
16209
:
Move
the
documentation
for
the
str
built
-
in
function
to
a
new
-
Issue
#
16209
:
Move
the
documentation
for
the
str
built
-
in
function
to
a
new
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment