[pypy-commit] pypy improve-errors-again: (Ronan, Edd) Move formatting of annotations into its own function.
vext01
noreply at buildbot.pypy.org
Wed Aug 28 18:26:15 CEST 2013
Author: Edd Barrett <vext01 at gmail.com>
Branch: improve-errors-again
Changeset: r66411:c39e6e158893
Date: 2013-08-28 11:18 +0100
http://bitbucket.org/pypy/pypy/changeset/c39e6e158893/
Log: (Ronan, Edd) Move formatting of annotations into its own function.
diff --git a/rpython/tool/error.py b/rpython/tool/error.py
--- a/rpython/tool/error.py
+++ b/rpython/tool/error.py
@@ -94,15 +94,21 @@
msg += source_lines(graph, block, operindex, long=True)
if oper is not None:
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 += format_annotations(annotator, oper)
+ msg += ['']
return "\n".join(msg)
+def format_annotations(annotator, oper):
+ msg = []
+ 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
+ return msg
+
def format_blocked_annotation_error(annotator, blocked_blocks):
text = []
for block, (graph, index) in blocked_blocks.items():
More information about the pypy-commit
mailing list