[pypy-svn] r65576 - pypy/branch/pyjitpl5-experiments/pypy/translator

arigo at codespeak.net arigo at codespeak.net
Thu Jun 4 15:47:02 CEST 2009


Author: arigo
Date: Thu Jun  4 15:47:01 2009
New Revision: 65576

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/translator/exceptiontransform.py
Log:
Crash with an ll_assert() when raising an AssertionError.
In lldebug builds this lets us find the location that
raises AssertionError more easily.


Modified: pypy/branch/pyjitpl5-experiments/pypy/translator/exceptiontransform.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/translator/exceptiontransform.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/translator/exceptiontransform.py	Thu Jun  4 15:47:01 2009
@@ -13,6 +13,7 @@
 from pypy.rpython.rmodel import inputconst
 from pypy.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong
 from pypy.rlib.rarithmetic import r_singlefloat
+from pypy.rlib.debug import ll_assert
 from pypy.annotation import model as annmodel
 from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
 
@@ -59,6 +60,11 @@
         runtime_error_def = translator.annotator.bookkeeper.getuniqueclassdef(RuntimeError)
         runtime_error_ll_exc = edata.get_standard_ll_exc_instance(translator.rtyper, runtime_error_def)
         runtime_error_ll_exc_type = rclass.ll_inst_type(runtime_error_ll_exc)
+        bk = translator.annotator.bookkeeper
+        assertion_error_def = bk.getuniqueclassdef(AssertionError)
+        assertion_error_ll_exc = edata.get_standard_ll_exc_instance(
+            translator.rtyper, assertion_error_def)
+        assertion_error_ll_exc_type=rclass.ll_inst_type(assertion_error_ll_exc)
 
         def rpyexc_occured():
             exc_type = exc_data.exc_type
@@ -76,6 +82,7 @@
 
         def rpyexc_raise(etype, evalue):
             # assert(!RPyExceptionOccurred());
+            ll_assert(etype != assertion_error_ll_exc_type, "AssertionError!")
             exc_data.exc_type = etype
             exc_data.exc_value = evalue
 



More information about the Pypy-commit mailing list