mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Fix a crasher where Python code managed to infinitely recurse in C code without
ever going back out to Python code in PyObject_Call(). Required introducing a static RuntimeError instance so that normalizing an exception there is no reliance on a recursive call that would put the exception system over the recursion check itself.
This commit is contained in:
parent
68a6da99e6
commit
1e534b5425
11 changed files with 66 additions and 49 deletions
|
@ -1857,7 +1857,11 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
|
|||
ternaryfunc call;
|
||||
|
||||
if ((call = func->ob_type->tp_call) != NULL) {
|
||||
PyObject *result = (*call)(func, arg, kw);
|
||||
PyObject *result;
|
||||
if (Py_EnterRecursiveCall(" while calling a Python object"))
|
||||
return NULL;
|
||||
result = (*call)(func, arg, kw);
|
||||
Py_LeaveRecursiveCall();
|
||||
if (result == NULL && !PyErr_Occurred())
|
||||
PyErr_SetString(
|
||||
PyExc_SystemError,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue