@@ -3729,27 +3729,28 @@ dummy_func(
37293729 }
37303730 assert (PyTuple_CheckExact (callargs ));
37313731 EVAL_CALL_STAT_INC_IF_FUNCTION (EVAL_CALL_FUNCTION_EX , func );
3732- if (opcode == INSTRUMENTED_CALL_FUNCTION_EX &&
3733- !PyFunction_Check (func ) && !PyMethod_Check (func )
3734- ) {
3732+ if (opcode == INSTRUMENTED_CALL_FUNCTION_EX ) {
37353733 PyObject * arg = PyTuple_GET_SIZE (callargs ) > 0 ?
37363734 PyTuple_GET_ITEM (callargs , 0 ) : Py_None ;
37373735 int err = _Py_call_instrumentation_2args (
37383736 tstate , PY_MONITORING_EVENT_CALL ,
37393737 frame , this_instr , func , arg );
37403738 if (err ) GOTO_ERROR (error );
37413739 result = PyObject_Call (func , callargs , kwargs );
3742- if (result == NULL ) {
3743- _Py_call_instrumentation_exc2 (
3744- tstate , PY_MONITORING_EVENT_C_RAISE ,
3745- frame , this_instr , func , arg );
3746- }
3747- else {
3748- int err = _Py_call_instrumentation_2args (
3749- tstate , PY_MONITORING_EVENT_C_RETURN ,
3750- frame , this_instr , func , arg );
3751- if (err < 0 ) {
3752- Py_CLEAR (result );
3740+
3741+ if (!PyFunction_Check (func ) && !PyMethod_Check (func )) {
3742+ if (result == NULL ) {
3743+ _Py_call_instrumentation_exc2 (
3744+ tstate , PY_MONITORING_EVENT_C_RAISE ,
3745+ frame , this_instr , func , arg );
3746+ }
3747+ else {
3748+ int err = _Py_call_instrumentation_2args (
3749+ tstate , PY_MONITORING_EVENT_C_RETURN ,
3750+ frame , this_instr , func , arg );
3751+ if (err < 0 ) {
3752+ Py_CLEAR (result );
3753+ }
37533754 }
37543755 }
37553756 }
0 commit comments