Hi, 2011/9/28 Łukasz Ligowski <orangewarr...@gmail.com>
> Hello, > > I'd like to know what is the purpose of offset field on > pypy.objspace.flow.model.SpaceOperation object. > It is labeled as "offset in code string" but I have problem to find > the right string. > I tried with string that is returned by using string returned by > FunctionGraph.getsource() but it didn't bring expected results. > > What I try to accomplish is to learn whether it is possible to map > particular SpaceOperation with right line of original source file. > The "code string" is very likely the bytecode of the Python function, i.e f.__code__.co_code. It's not very easy to get back to the original source line. f.__code__.co_firstlineno gives the first line number, and other lines must be computed with the help of f.__code__.co_lnotab. Good luck with this one. You may want to look at the "dis" module to see how it is used. -- Amaury Forgeot d'Arc
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev