diff options
author | Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> | 2021-10-28 15:02:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 15:02:34 (GMT) |
commit | 0a1a36b74bdf8da286924a1c9652853b1c46f536 (patch) | |
tree | e2fe66e3f2c66edca11acb29c2115c6ce6c7b7db /Python | |
parent | f291404a802d6a1bc50f817c7a26ff3ac9a199ff (diff) | |
download | cpython-0a1a36b74bdf8da286924a1c9652853b1c46f536.zip cpython-0a1a36b74bdf8da286924a1c9652853b1c46f536.tar.gz cpython-0a1a36b74bdf8da286924a1c9652853b1c46f536.tar.bz2 |
bpo-44525: Add recursive checks for `CALL_FUNCTION_BUILTIN_O` (GH-29271)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 4ac0b53..d52ca9c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4742,8 +4742,14 @@ check_eval_breaker: STAT_INC(CALL_FUNCTION, hit); PyCFunction cfunc = PyCFunction_GET_FUNCTION(callable); + // This is slower but CPython promises to check all non-vectorcall + // function calls. + if (_Py_EnterRecursiveCall(tstate, " while calling a Python object")) { + goto error; + } PyObject *arg = POP(); PyObject *res = cfunc(PyCFunction_GET_SELF(callable), arg); + _Py_LeaveRecursiveCall(tstate); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); /* Clear the stack of the function object. */ |