Author: Armin Rigo <[email protected]>
Branch: kill-someobject
Changeset: r57970:5543bcb2c705
Date: 2012-10-10 13:19 +0200
http://bitbucket.org/pypy/pypy/changeset/5543bcb2c705/

Log:    Needs a custom ErrorWrapper class to repr nicely instead of with
        escaping.

diff --git a/pypy/annotation/annrpython.py b/pypy/annotation/annrpython.py
--- a/pypy/annotation/annrpython.py
+++ b/pypy/annotation/annrpython.py
@@ -2,7 +2,7 @@
 from pypy.tool.ansi_print import ansi_log
 from pypy.tool.pairtype import pair
 from pypy.tool.error import (format_blocked_annotation_error,
-                             AnnotatorError, gather_error)
+                             AnnotatorError, gather_error, ErrorWrapper)
 from pypy.objspace.flow.model import (Variable, Constant, FunctionGraph,
                                       c_last_exception, checkgraph)
 from pypy.translator import simplify, transform
@@ -593,7 +593,8 @@
             resultcell = consider_meth(*argcells)
         except Exception, e:
             graph = self.bookkeeper.position_key[0]
-            e.args = e.args + (gather_error(self, graph, block, opindex),)
+            e.args = e.args + (
+                ErrorWrapper(gather_error(self, graph, block, opindex)),)
             raise
         if resultcell is None:
             resultcell = self.noreturnvalue(op)
diff --git a/pypy/tool/error.py b/pypy/tool/error.py
--- a/pypy/tool/error.py
+++ b/pypy/tool/error.py
@@ -70,6 +70,13 @@
 class NoSuchAttrError(Exception):
     pass
 
+class ErrorWrapper(object):
+    def __init__(self, msg):
+        self.msg = msg
+
+    def __repr__(self):
+        return '<%s>' % (self.msg,)
+
 def gather_error(annotator, graph, block, operindex):
     msg = [""]
 
@@ -101,7 +108,7 @@
     return '\n'.join(text)
 
 def format_simple_call(annotator, oper, msg):
-    msg.append("Simple call of incompatible family:")
+    msg.append("Occurred processing the following simple_call:")
     try:
         descs = annotator.bindings[oper.args[0]].descriptions
     except (KeyError, AttributeError), e:
@@ -124,13 +131,6 @@
             except (AttributeError, TypeError):
                 r = repr(desc)
         msg.append("  %s returning" % (r,))
-        if hasattr(desc, 'getuniquegraph'):
-            graph = desc.getuniquegraph()
-            r = annotator.binding(graph.returnblock.inputargs[0],
-                                  "(no annotation)")
-        else:
-            r = '?'
-        msg.append("      %s" % (r,))
         msg.append("")
 
 def debug(drv, use_pdb=True):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to