79657908

Date: 2025-06-08 14:21:26
Score: 1.5
Natty:
Report link

Take a look at this other stackoverflow question. I think getting the current depth of the stack reliably distinguishes between execution contexts regardless of filename. It should automatically separate a wrapping call (shallow) from user-defined code (deep). From here, it says "The trace hook is modified by passing a callback function to sys.settrace()." So I think you can filter out events when the depth <= 3. As soon as the depth is > 3, you can start tracing since the deep stack is user-defined functions.

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Has code block (-0.5):
  • Single line (0.5):
  • Low reputation (0.5):
Posted by: Pratik Mathur