[pypy-commit] pypy default: Clarify the assertion error.

arigo noreply at buildbot.pypy.org
Wed Dec 24 20:36:10 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r75107:8e44078cb486
Date: 2014-12-24 20:36 +0100
http://bitbucket.org/pypy/pypy/changeset/8e44078cb486/

Log:	Clarify the assertion error.

diff --git a/rpython/jit/metainterp/virtualizable.py b/rpython/jit/metainterp/virtualizable.py
--- a/rpython/jit/metainterp/virtualizable.py
+++ b/rpython/jit/metainterp/virtualizable.py
@@ -49,7 +49,13 @@
             ARRAYPTR = fieldType(VTYPE, name)
             ARRAY = deref(ARRAYPTR)
             assert isinstance(ARRAYPTR, lltype.Ptr)
-            assert isinstance(ARRAY, lltype.GcArray)
+            if not isinstance(ARRAY, lltype.GcArray):
+                raise Exception(
+                    "The virtualizable field '%s' is not an array (found %r)."
+                    " It usually means that you must try harder to ensure that"
+                    " the list is not resized at run-time. You can do that by"
+                    " using rpython.rlib.debug.make_sure_not_resized()." %
+                    (name, ARRAY))
             ARRAYITEMTYPES.append(arrayItem(ARRAY))
         self.array_descrs = [cpu.arraydescrof(deref(fieldType(VTYPE, name)))
                              for name in array_fields]


More information about the pypy-commit mailing list