Co-authored-by: Prakash Sellathurai <prakashsellathurai@gmail.com>
--- /dev/null
+Fix OOM error handling in :c:func:`PyFrame_GetBack` to propagate exceptions instead of masking them as None.
/*[clinic end generated code: output=3a84c22a55a63c79 input=9e528570d0e1f44a]*/
{
PyObject *res = (PyObject *)PyFrame_GetBack(self);
- if (res == NULL) {
+ if (res == NULL && !PyErr_Occurred()) {
Py_RETURN_NONE;
}
return res;
prev = _PyFrame_GetFirstComplete(prev);
if (prev) {
back = _PyFrame_GetFrameObject(prev);
+ if (back == NULL) {
+ return NULL;
+ }
}
}
return (PyFrameObject*)Py_XNewRef(back);