From 7eab0d000cd12d76f90d4a80df1b728d3ff94728 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 15 Jul 2013 21:16:27 +0200 Subject: [PATCH] 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. --- Python/ceval.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index 61928e39fe7..5a35524a247 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3090,7 +3090,10 @@ fast_block_end: Python main loop. */ PyErr_NormalizeException( &exc, &val, &tb); - PyException_SetTraceback(val, tb); + if (tb != NULL) + PyException_SetTraceback(val, tb); + else + PyException_SetTraceback(val, Py_None); Py_INCREF(exc); tstate->exc_type = exc; Py_INCREF(val);