Hi Anatoly, You should really post this on python-users. For these matters pypy mostly tries to re-implement CPython behavior, without any consideration for a consistent design.
2013/3/21 anatoly techtonik <[email protected]> > Hi, > > I am puzzled. The documentation mentions writable .f_trace attribute for a > frame. > "if not None, is a function called at the start of each source code line" > http://docs.python.org/2/reference/datamodel.html#types > > But there is also a trace function set by sys.settrace with 'line' event > http://docs.python.org/2/library/sys.html#sys.settrace > > What's the difference? Why the f_trace is needed? > > It is also unclear who sets f_trace, because it should be set at the > beginning of each frame before the frame starts executing. > A hint though: the docs for settrace say: """ 'call' A function is called (or some other code block entered). The global trace function is called; arg is None; the return value specifies the local trace function. """ So f_trace is the local trace function, sys.settrace is the global one. > Why do I need it? I wanted to make a scroller for a live Python code long > ago, and now that I am deep inside Python frames (thanks to xtrace > bugreport I got earlier) it sounds like a good time for it. > > The only concern I have is if 'line' event will be enough to cover all the > code that Python executes in settrace set function. > Profilers and code coverage tools use the trace function, so your case should be covered as well. -- Amaury Forgeot d'Arc
_______________________________________________ pypy-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/pypy-dev
