Skip to content

Commit 7536e69

Browse files
committed
Return Py_EnterRecursiveCall to _PyObject_FastCallDict
1 parent 78a0644 commit 7536e69

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Objects/call.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,23 @@ _PyObject_FastCallDict(PyObject *callable, PyObject *const *args,
107107
return _PyObject_MakeTpCall(callable, args, nargs, kwargs);
108108
}
109109

110-
PyObject *res;
110+
PyObject *res = NULL;
111111
if (kwargs == NULL) {
112-
res = func(callable, args, nargsf, NULL);
112+
if (Py_EnterRecursiveCall(" while calling a Python object") == 0) {
113+
res = func(callable, args, nargsf, NULL);
114+
Py_LeaveRecursiveCall();
115+
}
113116
}
114117
else {
115118
PyObject *kwnames;
116119
PyObject *const *newargs;
117120
if (_PyStack_UnpackDict(args, nargs, kwargs, &newargs, &kwnames) < 0) {
118121
return NULL;
119122
}
120-
res = func(callable, newargs, nargs, kwnames);
123+
if (Py_EnterRecursiveCall(" while calling a Python object") == 0) {
124+
res = func(callable, newargs, nargs, kwnames);
125+
Py_LeaveRecursiveCall();
126+
}
121127
if (kwnames != NULL) {
122128
Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames) + nargs;
123129
for (i = 0; i < n; i++) {

0 commit comments

Comments
 (0)