◐ Shell
clean mode source ↗

[3.13] gh-146092: Handle _PyFrame_GetFrameObject() failures properly (GH-146124) (GH-146132) by miss-islington · Pull Request #146138 · python/cpython

Expand Up @@ -2031,14 +2031,17 @@ _PyEval_ExceptionGroupMatch(PyObject* exc_value, PyObject *match_type, PyThreadState *tstate = _PyThreadState_GET(); _PyInterpreterFrame *frame = _PyThreadState_GetFrame(tstate); PyFrameObject *f = _PyFrame_GetFrameObject(frame); if (f != NULL) { PyObject *tb = _PyTraceBack_FromFrame(NULL, f); if (tb == NULL) { return -1; } PyException_SetTraceback(wrapped, tb); Py_DECREF(tb); if (f == NULL) { Py_DECREF(wrapped); return -1; }
PyObject *tb = _PyTraceBack_FromFrame(NULL, f); if (tb == NULL) { return -1; } PyException_SetTraceback(wrapped, tb); Py_DECREF(tb); *match = wrapped; } *rest = Py_NewRef(Py_None); Expand Down Expand Up @@ -2505,6 +2508,11 @@ PyEval_GetLocals(void)
if (PyFrameLocalsProxy_Check(locals)) { PyFrameObject *f = _PyFrame_GetFrameObject(current_frame); if (f == NULL) { Py_DECREF(locals); return NULL; }
PyObject *ret = f->f_locals_cache; if (ret == NULL) { ret = PyDict_New(); Expand Down