[Python-ideas] Idea: Allow multiple levels of tracers

Barry Scott barry at barrys-emacs.org
Sun Apr 28 04:29:46 EDT 2019



> On 28 Apr 2019, at 09:12, Ram Rachum <ram.rachum at gmail.com> wrote:
> 
> It's possible, but it would be very cumbersome, for a bunch of reasons. One of them is that the tracing code inspects the frame, the variables referenced in it, and it even opens the file of the code object of the frame. It will be difficult to mock all of that, and even if that's possible, we won't have high confidence that the mock is reliable.

It is not so scary that I would not take it on myself if I had the need.
Maybe you use real frames and only fake up the call into the tracecode.

What I'm thinking is that it is possible and can be done today without C level changes to Python.

Maybe if there are changes to the C python it only needs a second tracehook that runs for the
code in the sys.settrace only.

Barry



More information about the Python-ideas mailing list