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
d1b48998
Commit
d1b48998
authored
Oct 28, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19421: add an unit test for warnings.warn() during finalization
parent
ce5f4fba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
Lib/test/test_warnings.py
Lib/test/test_warnings.py
+19
-0
No files found.
Lib/test/test_warnings.py
View file @
d1b48998
...
...
@@ -788,6 +788,25 @@ class BootstrapTest(unittest.TestCase):
env
=
env
)
self
.
assertEqual
(
retcode
,
0
)
class
FinalizationTest
(
unittest
.
TestCase
):
def
test_finalization
(
self
):
# Issue #19421: warnings.warn() should not crash
# during Python finalization
code
=
"""
import warnings
warn = warnings.warn
class A:
def __del__(self):
warn("test")
a=A()
"""
rc
,
out
,
err
=
assert_python_ok
(
"-c"
,
code
)
# note: "__main__" filename is not correct, it should be the name
# of the script
self
.
assertEqual
(
err
,
b'__main__:7: UserWarning: test'
)
def
setUpModule
():
py_warnings
.
onceregistry
.
clear
()
...
...
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