Author: Alexander Hesse <webmas...@aquanasoft.de> Branch: split-rpython Changeset: r59821:f54abb775eb1 Date: 2013-01-06 19:57 +0100 http://bitbucket.org/pypy/pypy/changeset/f54abb775eb1/
Log: Moved offset2lineno from pypy.interpreter.pytraceback to rpython.tool.error diff --git a/pypy/interpreter/pytraceback.py b/pypy/interpreter/pytraceback.py --- a/pypy/interpreter/pytraceback.py +++ b/pypy/interpreter/pytraceback.py @@ -1,5 +1,6 @@ from pypy.interpreter import baseobjspace from pypy.interpreter.error import OperationError +from rpython.tool.error import offset2lineno class PyTraceback(baseobjspace.Wrappable): @@ -55,17 +56,6 @@ tb = PyTraceback(space, frame, last_instruction, tb) operror.set_traceback(tb) -def offset2lineno(c, stopat): - tab = c.co_lnotab - line = c.co_firstlineno - addr = 0 - for i in range(0, len(tab), 2): - addr = addr + ord(tab[i]) - if addr > stopat: - break - line = line + ord(tab[i+1]) - return line - def check_traceback(space, w_tb, msg): from pypy.interpreter.typedef import PyTraceback tb = space.interpclass_w(w_tb) diff --git a/rpython/tool/error.py b/rpython/tool/error.py --- a/rpython/tool/error.py +++ b/rpython/tool/error.py @@ -14,8 +14,6 @@ SHOW_ANNOTATIONS = True SHOW_DEFAULT_LINES_OF_CODE = 0 -from pypy.interpreter.pytraceback import offset2lineno - def source_lines1(graph, block, operindex=None, offset=None, long=False, \ show_lines_of_code=SHOW_DEFAULT_LINES_OF_CODE): if block is not None: @@ -161,3 +159,15 @@ if use_pdb: pdb_plus_show = PdbPlusShow(t) pdb_plus_show.start(tb) + + +def offset2lineno(c, stopat): + tab = c.co_lnotab + line = c.co_firstlineno + addr = 0 + for i in range(0, len(tab), 2): + addr = addr + ord(tab[i]) + if addr > stopat: + break + line = line + ord(tab[i+1]) + return line \ No newline at end of file diff --git a/rpython/translator/tool/make_dot.py b/rpython/translator/tool/make_dot.py --- a/rpython/translator/tool/make_dot.py +++ b/rpython/translator/tool/make_dot.py @@ -4,7 +4,7 @@ from rpython.flowspace.objspace import FlowObjSpace as Space from rpython.tool.udir import udir from py.process import cmdexec -from pypy.interpreter.pytraceback import offset2lineno +from rpython.tool.error import offset2lineno class DotGen: _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit