-
-
Save kergoth/3f0b24517194d4dd805028dd400bdd04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def trace_calls(): | |
import inspect, sys, traceback | |
def tracer(frame, event, arg): | |
if event == 'call': | |
lineno = frame.f_lineno | |
co = frame.f_code | |
filename = co.co_filename | |
name = co.co_name | |
if filename.startswith(sys.prefix): | |
return | |
summary = traceback.FrameSummary(filename, lineno, name, lookup_line=False, locals=frame.f_locals) | |
for i in traceback.format_list([summary]): | |
bb.warn(i) | |
sys.setprofile(tracer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment