Author: Armin Rigo <[email protected]>
Branch: stm-gc
Changeset: r54261:f170650418ee
Date: 2012-04-05 12:10 +0200
http://bitbucket.org/pypy/pypy/changeset/f170650418ee/
Log: Crash with a clearer error message when not translated.
diff --git a/pypy/rlib/debug.py b/pypy/rlib/debug.py
--- a/pypy/rlib/debug.py
+++ b/pypy/rlib/debug.py
@@ -1,5 +1,6 @@
import sys, time
from pypy.rpython.extregistry import ExtRegistryEntry
+from pypy.rlib.objectmodel import we_are_translated
from pypy.rlib.rarithmetic import is_valid_int
@@ -21,8 +22,13 @@
hop.exception_cannot_occur()
hop.genop('debug_assert', vlist)
+class FatalError(Exception):
+ pass
+
def fatalerror(msg):
# print the RPython traceback and abort with a fatal error
+ if not we_are_translated():
+ raise FatalError(msg)
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.lltypesystem.lloperation import llop
llop.debug_print_traceback(lltype.Void)
@@ -33,6 +39,8 @@
def fatalerror_notb(msg):
# a variant of fatalerror() that doesn't print the RPython traceback
+ if not we_are_translated():
+ raise FatalError(msg)
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.lltypesystem.lloperation import llop
llop.debug_fatalerror(lltype.Void, msg)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit