diff --git a/Objects/genobject.c b/Objects/genobject.c index e55cfd21c69..453b1003300 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -1128,6 +1128,9 @@ compute_cr_origin(int origin_depth) /* Now collect them */ PyObject *cr_origin = PyTuple_New(frame_count); + if (cr_origin == NULL) { + return NULL; + } frame = PyEval_GetFrame(); for (int i = 0; i < frame_count; ++i) { PyObject *frameinfo = Py_BuildValue(