[pypy-svn] r52514 - pypy/branch/jit-hotpath/pypy/rpython

arigo at codespeak.net arigo at codespeak.net
Fri Mar 14 17:23:34 CET 2008


Author: arigo
Date: Fri Mar 14 17:23:34 2008
New Revision: 52514

Modified:
   pypy/branch/jit-hotpath/pypy/rpython/error.py
   pypy/branch/jit-hotpath/pypy/rpython/rtyper.py
Log:
A much-needed enhancement to TyperError: give the
name of the graph where the error occurred.


Modified: pypy/branch/jit-hotpath/pypy/rpython/error.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/rpython/error.py	(original)
+++ pypy/branch/jit-hotpath/pypy/rpython/error.py	Fri Mar 14 17:23:34 2008
@@ -3,7 +3,7 @@
     def __str__(self):
         result = Exception.__str__(self)
         if hasattr(self, 'where'):
-            result += '\n.. %r\n.. %r' % self.where
+            result += '\n.. %s\n.. %r\n.. %r' % self.where
         return result
 
 class MissingRTypeOperation(TyperError):

Modified: pypy/branch/jit-hotpath/pypy/rpython/rtyper.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/rpython/rtyper.py	(original)
+++ pypy/branch/jit-hotpath/pypy/rpython/rtyper.py	Fri Mar 14 17:23:34 2008
@@ -259,8 +259,7 @@
             if minimize and isinstance(err, BrokenReprTyperError): 
                 bc += 1
                 continue
-            block, position = err.where
-            graph = self.annotator.annotated.get(block, None)
+            graph, block, position = err.where
             errmsg = ("TyperError-%d: %s\n" % (c, graph) +
                       str(err) +
                       "\n")
@@ -525,7 +524,8 @@
         """Record a TyperError without crashing immediately.
         Put a 'TyperError' operation in the graph instead.
         """
-        e.where = (block, position)
+        graph = self.annotator.annotated.get(block)
+        e.where = (graph, block, position)
         self.typererror_count += 1
         if self.crash_on_first_typeerror:
             raise



More information about the Pypy-commit mailing list