mirror of
https://github.com/python/cpython.git
synced 2026-06-28 03:41:13 +00:00
[3.15] gh-151905: fix memory error handling in PyFrame_GetBack (GH-151906) (#151919)
Co-authored-by: Prakash Sellathurai <prakashsellathurai@gmail.com>
This commit is contained in:
parent
752e23ec90
commit
fe5dc86f1f
2 changed files with 5 additions and 1 deletions
|
|
@ -0,0 +1 @@
|
|||
Fix OOM error handling in :c:func:`PyFrame_GetBack` to propagate exceptions instead of masking them as None.
|
||||
|
|
@ -1117,7 +1117,7 @@ frame_back_get_impl(PyFrameObject *self)
|
|||
/*[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;
|
||||
|
|
@ -2405,6 +2405,9 @@ PyFrame_GetBack(PyFrameObject *frame)
|
|||
prev = _PyFrame_GetFirstComplete(prev);
|
||||
if (prev) {
|
||||
back = _PyFrame_GetFrameObject(prev);
|
||||
if (back == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (PyFrameObject*)Py_XNewRef(back);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue