From 4b0b2dbfbb44b0d672c0a3cc1c022e697fa31f74 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 2 Oct 2023 23:48:27 +0300 Subject: [PATCH] gh-110241: Add missing error check to `record_eval` in `_testinternalcapi` --- Modules/_testinternalcapi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index c6b80fffdec16d..05bac0936b155d 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -675,7 +675,11 @@ record_eval(PyThreadState *tstate, struct _PyInterpreterFrame *f, int exc) assert(module != NULL); module_state *state = get_module_state(module); Py_DECREF(module); - PyList_Append(state->record_list, ((PyFunctionObject *)f->f_funcobj)->func_name); + int res = PyList_Append(state->record_list, + ((PyFunctionObject *)f->f_funcobj)->func_name); + if (res < 0) { + return NULL; + } } return _PyEval_EvalFrameDefault(tstate, f, exc); }