Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3.3 Changeset: r75140:45ae7aa92dd8 Date: 2014-12-21 10:15 +0100 http://bitbucket.org/pypy/pypy/changeset/45ae7aa92dd8/
Log: Add faulthandler._fatal_error() diff --git a/pypy/module/faulthandler/__init__.py b/pypy/module/faulthandler/__init__.py --- a/pypy/module/faulthandler/__init__.py +++ b/pypy/module/faulthandler/__init__.py @@ -18,4 +18,5 @@ '_sigabrt': 'interp_faulthandler.sigabrt', '_sigbus': 'interp_faulthandler.sigbus', '_sigill': 'interp_faulthandler.sigill', + '_fatal_error': 'interp_faulthandler.fatal_error', } diff --git a/pypy/module/faulthandler/interp_faulthandler.py b/pypy/module/faulthandler/interp_faulthandler.py --- a/pypy/module/faulthandler/interp_faulthandler.py +++ b/pypy/module/faulthandler/interp_faulthandler.py @@ -119,3 +119,9 @@ def sigill(): pypy_faulthandler_sigill() + +@unwrap_spec(msg=str) +def fatal_error(space, msg): + os.write(2, "Fatal Python error: %s\n" % msg); + dump_traceback(space, space.wrap(None), space.wrap(True)) + raise RuntimeError(msg) diff --git a/pypy/module/faulthandler/test/test_faulthander.py b/pypy/module/faulthandler/test/test_faulthander.py --- a/pypy/module/faulthandler/test/test_faulthander.py +++ b/pypy/module/faulthandler/test/test_faulthander.py @@ -1,3 +1,9 @@ +from pypy.module.faulthandler import interp_faulthandler + +class TestFaultHandler: + def test_fatal_error(self, space): + raises(RuntimeError, interp_faulthandler.fatal_error, space, "Message") + class AppTestFaultHandler: spaceconfig = { "usemodules": ["faulthandler"] _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit