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.
In code like this:
The
trace_module
puts hidden functions like_treetrace_hidden_before_expr
in the globals, which implicitly refer to aTracedFile
for everything after the import.The call to
@eye
replaces the hidden globals with new slightly different globals with aTracedFile
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.