Hi,<br><br><div class="gmail_quote">2011/9/28 Łukasz Ligowski <span dir="ltr"><<a href="mailto:orangewarrior@gmail.com">orangewarrior@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br>
<br>
I'd like to know what is the purpose of offset field on<br>
pypy.objspace.flow.model.SpaceOperation object.<br>
It is labeled as "offset in code string" but I have problem to find<br>
the right string.<br>
I tried with string that is returned by using string returned by<br>
FunctionGraph.getsource() but it didn't bring expected results.<br>
<br>
What I try to accomplish is to learn whether it is possible to map<br>
particular SpaceOperation with right line of original source file.<br></blockquote><div><br></div><div>The "code string" is very likely the bytecode of the Python function,</div><div>i.e f.__code__.co_code.</div>
<div>It's not very easy to get back to the original source line.</div><div>f.__code__.co_firstlineno gives the first line number, and other lines</div><div>must be computed with the help of f.__code__.co_lnotab.</div>
<div>Good luck with this one. You may want to look at the "dis" module</div><div>to see how it is used.</div><div> </div></div>-- <br>Amaury Forgeot d'Arc<br>