8000 bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). by serhiy-storchaka · Pull Request #2034 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). #2034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test and Misc/NEWS entry.
  • Loading branch information
serhiy-storchaka committed Jun 11, 2017
commit 7963df25f2ae2fd8cfa6f0198a63925384112385
10 changes: 10 additions & 0 deletions Lib/test/test_atexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def raise1():
def raise2():
raise SystemError

def exit():
raise SystemExit


class GeneralTest(unittest.TestCase):

Expand Down Expand Up @@ -76,6 +79,13 @@ def test_raise_unnormalized(self):
self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs)
self.assertIn("ZeroDivisionError", self.stream.getvalue())

def test_exit(self):
# be sure a SystemExit is handled properly
atexit.register(exit)

self.assertRaises(SystemExit, atexit._run_exitfuncs)
self.assertEqual(self.stream.getvalue(), '')

def test_print_tracebacks(self):
# Issue #18776: the tracebacks should be printed when errors occur.
def f():
Expand Down
3 changes: 3 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ Extension Modules
Library
-------

- bpo-28994: The traceback no longer displayed for SystemExit raised in
a callback registered by atexit.

- bpo-11822: The dis.dis() function now is able to disassemble nested
code objects.

Expand Down
0