Created
March 23, 2026 08:33
-
-
Save GeroZayas/5dd62ab52beeb3a4d033c7ce9ef897ad to your computer and use it in GitHub Desktop.
Use traceback to see who call a line
This file contains hidden or 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 traceback | |
| def objetivo(): | |
| stack = traceback.extract_stack() | |
| caller = stack[-2] # quien llamó a esta función | |
| print(f"{caller.filename}:{caller.lineno} -> {caller.name}") | |
| def a(): | |
| objetivo() | |
| a() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment