[pypy-commit] pypy rpython-error-to-systemerror: Add a way to get an RPython-level exception

arigo pypy.commits at gmail.com
Sun Nov 6 14:11:41 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: rpython-error-to-systemerror
Changeset: r88164:37f15c8c0ecf
Date: 2016-11-06 20:11 +0100
http://bitbucket.org/pypy/pypy/changeset/37f15c8c0ecf/

Log:	Add a way to get an RPython-level exception

diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py
--- a/pypy/module/__pypy__/interp_magic.py
+++ b/pypy/module/__pypy__/interp_magic.py
@@ -86,7 +86,9 @@
         return space.w_None
     return space.get(w_descr, w_obj)
 
-def do_what_I_mean(space):
+def do_what_I_mean(space, w_crash=None):
+    if not space.is_none(w_crash):
+        raise ValueError    # RPython-level, uncaught
     return space.wrap(42)
 
 
diff --git a/pypy/module/__pypy__/test/test_special.py b/pypy/module/__pypy__/test/test_special.py
--- a/pypy/module/__pypy__/test/test_special.py
+++ b/pypy/module/__pypy__/test/test_special.py
@@ -92,6 +92,7 @@
         from __pypy__ import do_what_I_mean
         x = do_what_I_mean()
         assert x == 42
+        raises(SystemError, do_what_I_mean, 1)
 
     def test_list_strategy(self):
         from __pypy__ import strategy


More information about the pypy-commit mailing list