mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
[3.13] gh-134163: Fix an infinite loop when the process runs out of memory in a try
block (GH-138491)
Signed-off-by: yihong0618 <zouzou0208@gmail.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
443d4af2ee
commit
afec6a5460
3 changed files with 38 additions and 1 deletions
|
@ -912,7 +912,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
|
|||
int frame_lasti = _PyInterpreterFrame_LASTI(frame);
|
||||
PyObject *lasti = PyLong_FromLong(frame_lasti);
|
||||
if (lasti == NULL) {
|
||||
goto exception_unwind;
|
||||
// Instead of going back to exception_unwind (which would cause
|
||||
// infinite recursion), directly exit to let the original exception
|
||||
// propagate up and hopefully be handled at a higher level.
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
goto exit_unwind;
|
||||
}
|
||||
PUSH(lasti);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue