From 4431a5875032a69ecf42ae88c467e8a8825b1327 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 3 Oct 2023 00:19:32 +0300 Subject: [PATCH] gh-110241: Add missing error check to `record_eval` in `_testinternalcapi` (GH-110242) (cherry picked from commit 4596c76d1a7650fd4650c814dc1d40d664cd8fb4) Co-authored-by: Nikita Sobolev --- Modules/_testinternalcapi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index 4e063a86152931..22d156725f545c 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -683,7 +683,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); }