Created
December 17, 2021 01:42
-
-
Save mamaj/87fe50ceae7367ca1b431c5edebae4a5 to your computer and use it in GitHub Desktop.
python trace
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
import sys | |
def tracer(frame, event, arg): | |
print(f'{frame = }') | |
print(f'{event = }') | |
print(f'{arg = }') | |
print() | |
# if you enter any function, still use the same trace function. | |
if event == 'call': | |
return tracer | |
sys.settrace(tracer) | |
def inc(i): | |
return i | |
inc(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment