Author: Matti Picus <[email protected]>
Branch: py3.6
Changeset: r97109:c85847cc3955
Date: 2019-08-08 20:02 +0300
http://bitbucket.org/pypy/pypy/changeset/c85847cc3955/
Log: test, fix raising SystemExit in atexit
diff --git a/pypy/module/atexit/app_atexit.py b/pypy/module/atexit/app_atexit.py
--- a/pypy/module/atexit/app_atexit.py
+++ b/pypy/module/atexit/app_atexit.py
@@ -26,13 +26,13 @@
try:
func(*args, **kwargs)
except BaseException as e:
+ last_exc = e
+ last_tb = e.__traceback__
if not isinstance(e, SystemExit):
import traceback
# obscure: we can't use sys.exc_info() here because this
# function is an appleveldef which marks its frame as
# hidden
- last_exc = e
- last_tb = e.__traceback__
traceback.print_exception(type(last_exc), last_exc, last_tb)
clear()
diff --git a/pypy/module/atexit/test/test_atexit.py
b/pypy/module/atexit/test/test_atexit.py
--- a/pypy/module/atexit/test/test_atexit.py
+++ b/pypy/module/atexit/test/test_atexit.py
@@ -25,3 +25,10 @@
import atexit
atexit.register(lambda: 1, 0, 0, (x for x in (1,2)), 0, 0)
raises(TypeError, atexit._run_exitfuncs)
+
+ def test_systemexit(self):
+ import atexit
+ def f():
+ raise SystemExit()
+ atexit.register(f)
+ raises(SystemExit, atexit._run_exitfuncs)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit