[pypy-svn] r29881 - pypy/dist/pypy/tool

pedronis at codespeak.net pedronis at codespeak.net
Sun Jul 9 12:21:24 CEST 2006


Author: pedronis
Date: Sun Jul  9 12:21:22 2006
New Revision: 29881

Modified:
   pypy/dist/pypy/tool/error.py
Log:
the why_not_annotated dict is populated only if annmodel.DEBUG == True



Modified: pypy/dist/pypy/tool/error.py
==============================================================================
--- pypy/dist/pypy/tool/error.py	(original)
+++ pypy/dist/pypy/tool/error.py	Sun Jul  9 12:21:22 2006
@@ -67,21 +67,26 @@
 def gather_error(annotator, block, graph):
     msg = []
     msg.append('-+' * 30)
-    msg.append("Operation cannot succeed")
-    _, _, operindex = annotator.why_not_annotated[block][1].break_at
-    oper = block.operations[operindex]
-    msg.append(" " + str(oper))
-    if SHOW_ANNOTATIONS:
-        msg.append("Known variable annotations:")
-        for arg in oper.args + [oper.result]:
-            if isinstance(arg, Variable):
-                try:
-                    msg.append(" " + str(arg) + " = " + str(annotator.binding(arg)))
-                except KeyError:
-                    pass
-        msg.append("")
-    if SHOW_TRACEBACK:
-        msg.extend(traceback.format_exception(*annotator.why_not_annotated[block]))
+    from pypy.annotation import model
+    if model.DEBUG:
+        msg.append("Operation cannot succeed")
+        _, _, operindex = annotator.why_not_annotated[block][1].break_at
+        oper = block.operations[operindex]
+        msg.append(" " + str(oper))
+        if SHOW_ANNOTATIONS:
+            msg.append("Known variable annotations:")
+            for arg in oper.args + [oper.result]:
+                if isinstance(arg, Variable):
+                    try:
+                        msg.append(" " + str(arg) + " = " + str(annotator.binding(arg)))
+                    except KeyError:
+                        pass
+            msg.append("")
+        if SHOW_TRACEBACK:
+            msg.extend(traceback.format_exception(*annotator.why_not_annotated[block]))
+    else:
+        msg.append("Blocked block")
+        operindex = None
     msg += source_lines(graph, block, operindex, long=True)
     return "\n".join(msg)
 



More information about the Pypy-commit mailing list