[pypy-commit] pypy default: Print some info to tell which virtualizable array field the error is about

arigo noreply at buildbot.pypy.org
Sun Mar 8 10:40:12 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r76279:a1abf06bc4ed
Date: 2015-03-08 10:40 +0100
http://bitbucket.org/pypy/pypy/changeset/a1abf06bc4ed/

Log:	Print some info to tell which virtualizable array field the error is
	about

diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -143,13 +143,16 @@
             return
         for v in list:
             if v in self.vable_array_vars:
+                vars = self.vable_array_vars[v]
+                (v_base, arrayfielddescr, arraydescr) = vars
                 raise AssertionError(
                     "A virtualizable array is passed around; it should\n"
                     "only be used immediately after being read.  Note\n"
                     "that a possible cause is indexing with an index not\n"
                     "known non-negative, or catching IndexError, or\n"
                     "not inlining at all (for tests: use listops=True).\n"
-                    "Occurred in: %r" % self.graph)
+                    "This is about: %r\n"
+                    "Occurred in: %r" % (arrayfielddescr, self.graph))
             # extra explanation: with the way things are organized in
             # rpython/rlist.py, the ll_getitem becomes a function call
             # that is typically meant to be inlined by the JIT, but
diff --git a/rpython/jit/codewriter/test/test_flatten.py b/rpython/jit/codewriter/test/test_flatten.py
--- a/rpython/jit/codewriter/test/test_flatten.py
+++ b/rpython/jit/codewriter/test/test_flatten.py
@@ -999,6 +999,7 @@
         e = py.test.raises(AssertionError, self.encoding_test, f, [], "!",
                            transform=True)
         assert str(e.value).startswith("A virtualizable array is passed aroun")
+        assert "<Descr>" in str(e.value)
 
     def test_vable_attribute_list_copied_around(self):
         class F:
@@ -1014,6 +1015,7 @@
         e = py.test.raises(AssertionError, self.encoding_test, f, [], "!",
                            transform=True)
         assert str(e.value).startswith("A virtualizable array is passed aroun")
+        assert "<Descr>" in str(e.value)
 
 
 def check_force_cast(FROM, TO, operations, value):


More information about the pypy-commit mailing list