8000 Add test and Misc/NEWS entry. · python/cpython@7963df2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7963df2

Browse files
Add test and Misc/NEWS entry.
1 parent 9f2f946 commit 7963df2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Lib/test/test_atexit.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def raise1():
2323
def raise2():
2424
raise SystemError
2525

26+
def exit():
27+
raise SystemExit
28+
2629

2730
class GeneralTest(unittest.TestCase):
2831

@@ -76,6 +79,13 @@ def test_raise_unnormalized(self):
7679
self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs)
7780
self.assertIn("ZeroDivisionError", self.stream.getvalue())
7881

82+
def test_exit(self):
83+
# be sure a SystemExit is handled properly
84+
atexit.register(exit)
85+
86+
self.assertRaises(SystemExit, atexit._run_exitfuncs)
87+
self.assertEqual(self.stream.getvalue(), '')
88+
7989
def test_print_tracebacks(self):
8090
# Issue #18776: the tracebacks should be printed when errors occur.
8191
def f():

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@ Extension Modules
355355
Library
356356
-------
357357

358+
- bpo-28994: The traceback no longer displayed for SystemExit raised in
359+
a callback registered by atexit.
360+
358361
- bpo-11822: The dis.dis() function now is able to disassemble nested
359362
code objects.
360363

0 commit comments

Comments
 (0)
0