alexmojaki/birdseye

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

alexmojaki opened this issue · 0 comments

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.