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
358e11d9
Commit
358e11d9
authored
Jan 05, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #10756: atexit normalizes the exception before displaying it.
parent
29e762c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
Lib/test/test_atexit.py
Lib/test/test_atexit.py
+8
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/atexitmodule.c
Modules/atexitmodule.c
+1
-0
No files found.
Lib/test/test_atexit.py
View file @
358e11d9
...
...
@@ -65,6 +65,14 @@ class TestCase(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
atexit
.
_run_exitfuncs
)
def
test_raise_unnormalized
(
self
):
# Issue #10756: Make sure that an unnormalized exception is
# handled properly
atexit
.
register
(
lambda
:
1
/
0
)
self
.
assertRaises
(
ZeroDivisionError
,
atexit
.
_run_exitfuncs
)
self
.
assertIn
(
"ZeroDivisionError"
,
self
.
stream
.
getvalue
())
def
test_stress
(
self
):
a
=
[
0
]
def
inc
():
...
...
Misc/NEWS
View file @
358e11d9
...
...
@@ -30,6 +30,8 @@ Core and Builtins
Library
-------
- Issue #10756: atexit normalizes the exception before displaying it.
- Issue #10790: email.header.Header.append's charset logic now works correctly
for charsets whose output codec is different from its input codec.
...
...
Modules/atexitmodule.c
View file @
358e11d9
...
...
@@ -72,6 +72,7 @@ atexit_callfuncs(void)
PyErr_Fetch
(
&
exc_type
,
&
exc_value
,
&
exc_tb
);
if
(
!
PyErr_ExceptionMatches
(
PyExc_SystemExit
))
{
PySys_WriteStderr
(
"Error in atexit._run_exitfuncs:
\n
"
);
PyErr_NormalizeException
(
&
exc_type
,
&
exc_value
,
&
exc_tb
);
PyErr_Display
(
exc_type
,
exc_value
,
exc_tb
);
}
}
...
...
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