Commit c6314892 authored by Jeremy Hylton's avatar Jeremy Hylton

Prevent a NULL pointer from being pushed onto the stack.

It's possible for PyErr_NormalizeException() to set the traceback
pointer to NULL.  I'm not sure how to provoke this directly from
Python, although it may be possible.  The error occurs when an
exception is set using PyErr_SetObject() and another exception occurs
while PyErr_NormalizeException() is creating the exception instance.

XXX As a result of this change, it's possible for an exception to
occur but sys.last_traceback to be left undefined.  Not sure if this
is a problem.
parent 479384e1
......@@ -2255,6 +2255,10 @@ eval_frame(PyFrameObject *f)
set_exc_info(tstate,
exc, val, tb);
}
if (tb == NULL) {
Py_INCREF(Py_None);
PUSH(Py_None);
} else
PUSH(tb);
PUSH(val);
PUSH(exc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment