8

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.

1 Answer 1

7

The docs are wrong, c_call events will never be sent to your trace function: http://bugs.python.org/issue17799

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.