[pypy-commit] pypy translation-cleanup: Inline format_global_error() into FlowingError.__str__()

rlamy noreply at buildbot.pypy.org
Thu Sep 20 19:39:23 CEST 2012


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: translation-cleanup
Changeset: r57437:67c63d7e4196
Date: 2012-09-20 02:51 +0100
http://bitbucket.org/pypy/pypy/changeset/67c63d7e4196/

Log:	Inline format_global_error() into FlowingError.__str__()

diff --git a/pypy/objspace/flow/flowcontext.py b/pypy/objspace/flow/flowcontext.py
--- a/pypy/objspace/flow/flowcontext.py
+++ b/pypy/objspace/flow/flowcontext.py
@@ -1,6 +1,6 @@
 import collections
 import sys
-from pypy.tool.error import format_global_error
+from pypy.tool.error import source_lines
 from pypy.interpreter.error import OperationError
 from pypy.interpreter.pytraceback import PyTraceback
 from pypy.interpreter import pyframe
@@ -22,8 +22,10 @@
         self.frame = frame
 
     def __str__(self):
-        return format_global_error(self.frame.graph, self.frame.last_instr,
-                str(self.msg))
+        msg = ['-+' * 30]
+        msg += map(str, self.args)
+        msg += source_lines(self.frame.graph, None, offset=self.frame.last_instr)
+        return "\n".join(msg)
 
 
 class StopFlowing(Exception):
diff --git a/pypy/tool/error.py b/pypy/tool/error.py
--- a/pypy/tool/error.py
+++ b/pypy/tool/error.py
@@ -174,13 +174,6 @@
     msg.append("  " + str(binding))
     return "\n".join(msg)
 
-def format_global_error(graph, offset, message):
-    msg = []
-    msg.append('-+' * 30)
-    msg.append(message)
-    msg += source_lines(graph, None, offset=offset)
-    return "\n".join(msg)
-
 def debug(drv, use_pdb=True):
     # XXX unify some code with pypy.translator.goal.translate
     from pypy.translator.tool.pdbplus import PdbPlusShow


More information about the pypy-commit mailing list