Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7eab0d0

Browse files
committed
Issue #18408: Fix PyEval_EvalFrameEx() for MemoryError
Don't pass a NULL traceback to PyException_SetTraceback(): pass Py_None. Passing NULL would raise a new exception.
1 parent a4ced86 commit 7eab0d0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Python/ceval.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3090,7 +3090,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
30903090
Python main loop. */
30913091
PyErr_NormalizeException(
30923092
&exc, &val, &tb);
3093-
PyException_SetTraceback(val, tb);
3093+
if (tb != NULL)
3094+
PyException_SetTraceback(val, tb);
3095+
else
3096+
PyException_SetTraceback(val, Py_None);
30943097
Py_INCREF(exc);
30953098
tstate->exc_type = exc;
30963099
Py_INCREF(val);

0 commit comments

Comments
 (0)