diff --git a/Python/ceval.c b/Python/ceval.c index 0add7ecc093..b2c90cc3b48 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2140,7 +2140,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) else { PyObject *build_class_str = _PyUnicode_FromId(&PyId___build_class__); if (build_class_str == NULL) - break; + goto error; bc = PyObject_GetItem(f->f_builtins, build_class_str); if (bc == NULL) { if (PyErr_ExceptionMatches(PyExc_KeyError)) @@ -2652,7 +2652,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) /* do the same if locals() is not a dict */ PyObject *ann_str = _PyUnicode_FromId(&PyId___annotations__); if (ann_str == NULL) { - break; + goto error; } ann_dict = PyObject_GetItem(f->f_locals, ann_str); if (ann_dict == NULL) {