The docs for sys.settrace mention that: >> event is a string: 'call', 'line', 'return', 'exception', >> 'c_call', 'c_return', or 'c_exception'
But in the code for ceval.c the only point where call_trace is invoked with PyTrace_C_CALL or PyTrace_C_RETURN is under the C_TRACE macro. In this macro this line prevents any function set up using sys.settrace to call call_trace with the mentioned arguments: if (tstate->use_tracing && tstate->c_profilefunc) Notice that from the code of PyEval_SetTrace and PyEval_SetProfile, only the later sets tstate->c_profilefunc and therefore only functions installed using sys.setprofile will recieve a c_call for the event. Xiang Zhan has suggested me to ask here what is the best course of action: 1) Document this behavior. 2) Fix the code. This question is related to this issue: https://bugs.python.org/issue17799 Thanks everyone for your time! Pablo
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com