diff options
author | Tian Gao <gaogaotiantian@hotmail.com> | 2024-03-14 16:23:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 16:23:15 (GMT) |
commit | 56a3c5f7674d65023bf84759b797e603f09a93e3 (patch) | |
tree | 260b76728a138a1e0b6e980b514bc9f2a58c15f3 /Python/bytecodes.c | |
parent | fc4d5fdffe3d9829b118232f35ccee61a27392ee (diff) | |
download | cpython-56a3c5f7674d65023bf84759b797e603f09a93e3.zip cpython-56a3c5f7674d65023bf84759b797e603f09a93e3.tar.gz cpython-56a3c5f7674d65023bf84759b797e603f09a93e3.tar.bz2 |
[3.12] gh-116626: Emit `CALL` events for all `INSTRUMENTED_CALL_FUNCTION_EX (GH-116732)
Backport of GH-116627
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index b957d88..ed8f671 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -3207,9 +3207,7 @@ dummy_func( } assert(PyTuple_CheckExact(callargs)); EVAL_CALL_STAT_INC_IF_FUNCTION(EVAL_CALL_FUNCTION_EX, func); - if (opcode == INSTRUMENTED_CALL_FUNCTION_EX && - !PyFunction_Check(func) && !PyMethod_Check(func) - ) { + if (opcode == INSTRUMENTED_CALL_FUNCTION_EX) { PyObject *arg = PyTuple_GET_SIZE(callargs) > 0 ? PyTuple_GET_ITEM(callargs, 0) : Py_None; int err = _Py_call_instrumentation_2args( @@ -3217,17 +3215,19 @@ dummy_func( frame, next_instr-1, func, arg); if (err) goto error; result = PyObject_Call(func, callargs, kwargs); - if (result == NULL) { - _Py_call_instrumentation_exc2( - tstate, PY_MONITORING_EVENT_C_RAISE, - frame, next_instr-1, func, arg); - } - else { - int err = _Py_call_instrumentation_2args( - tstate, PY_MONITORING_EVENT_C_RETURN, - frame, next_instr-1, func, arg); - if (err < 0) { - Py_CLEAR(result); + if (!PyFunction_Check(func) && !PyMethod_Check(func)) { + if (result == NULL) { + _Py_call_instrumentation_exc2( + tstate, PY_MONITORING_EVENT_C_RAISE, + frame, next_instr-1, func, arg); + } + else { + int err = _Py_call_instrumentation_2args( + tstate, PY_MONITORING_EVENT_C_RETURN, + frame, next_instr-1, func, arg); + if (err < 0) { + Py_CLEAR(result); + } } } } |