The documentation for sys.settrace
says that it can report calls to c or builtin functions. When I try following program, I expect to see a c_call
event, but nothing happens:
import sys
def tracer(frame, event, arg):
print(frame, event, arg)
return tracer
sys.settrace(tracer)
x = len([1,2,3])
Any ideas what's wrong here?
Can anyone post an example use of sys.settrace
which generates a c_call
event?
EDIT: Initially I tried it with Python 3.2, and it gave me no events. Now I tried it with Python 2.7 and it gave me two call
-s (not c_call
-s). Still weird.
The docs are wrong, c_call
events will never be sent to your trace function: http://bugs.python.org/issue17799
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With