summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2024-03-13 08:28:01 (GMT)
committerGitHub <noreply@github.com>2024-03-13 08:28:01 (GMT)
commit8332e85b2f079e8b9334666084d1f8495cff25c1 (patch)
tree76244f8c82fa00a35ed92956d09d0b10afcfd6d2 /Python/bytecodes.c
parentba82a241ac7ddee7cad18e9994f8dd560c68df02 (diff)
downloadcpython-8332e85b2f079e8b9334666084d1f8495cff25c1.zip
cpython-8332e85b2f079e8b9334666084d1f8495cff25c1.tar.gz
cpython-8332e85b2f079e8b9334666084d1f8495cff25c1.tar.bz2
gh-116626: Emit `CALL` events for all `INSTRUMENTED_CALL_FUNCTION_EX` (GH-116627)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 03e5f4e..ec05e40 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -3729,9 +3729,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(
@@ -3739,17 +3737,20 @@ dummy_func(
frame, this_instr, func, arg);
if (err) GOTO_ERROR(error);
result = PyObject_Call(func, callargs, kwargs);
- if (result == NULL) {
- _Py_call_instrumentation_exc2(
- tstate, PY_MONITORING_EVENT_C_RAISE,
- frame, this_instr, func, arg);
- }
- else {
- int err = _Py_call_instrumentation_2args(
- tstate, PY_MONITORING_EVENT_C_RETURN,
- frame, this_instr, 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, this_instr, func, arg);
+ }
+ else {
+ int err = _Py_call_instrumentation_2args(
+ tstate, PY_MONITORING_EVENT_C_RETURN,
+ frame, this_instr, func, arg);
+ if (err < 0) {
+ Py_CLEAR(result);
+ }
}
}
}