alexmojaki / birdseye

Graphical Python debugger which lets you easily view the values of all evaluated expressions
https://birdseye.readthedocs.io
MIT License
1.65k stars 71 forks source link

Cannot trace a module and use @eye at the same time #85

Closed alexmojaki closed 3 years ago

alexmojaki commented 4 years ago

In code like this:

import birdseye.trace_module
from birdseye import eye

@eye
def foo():

The trace_module puts hidden functions like _treetrace_hidden_before_expr in the globals, which implicitly refer to a TracedFile for everything after the import.

The call to @eye replaces the hidden globals with new slightly different globals with a TracedFile for the entire file.

Basically _trace_methods_dict and the code modification needs to use randomly generated global function names instead of static ones which conflict.