-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed as not planned
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
With a basic use of sys.monitoring to report calls of a function, everything works as expected:
from sys import monitoring
def foo():
for i in range(5):
if i > 4:
return "in foo"
monitoring.use_tool_id(0, "test")
def tracer(code, instruction_offset, c, arg0):
print("got args: ", arg0)
monitoring.register_callback(0, monitoring.events.CALL, tracer)
monitoring.set_local_events(0, foo.__code__, monitoring.events.CALL)
print(foo())
but if we modify foo to just be:
def foo():
return "in foo"
now tracer doesn't run. python supposedly doesn't do any inlining, but it seems that on simple trivially inlineable functions, that the CALL event isn't being triggered?
I tested this on python3.13.3 and against the latest git (Python 3.15.0a0 (heads/main:aec7f5f8b2e))
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error