Commit 34bb88dc authored by Xiang Zhang's avatar Xiang Zhang Committed by GitHub

Clear possible exception before calling PyTuple_Pack in IMPORT_NAME (GH-6033)

parent 55d5bfba
......@@ -2598,6 +2598,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
TARGET(IMPORT_NAME)
{
long res;
w = GETITEM(names, oparg);
x = PyDict_GetItemString(f->f_builtins, "__import__");
if (x == NULL) {
......@@ -2608,7 +2609,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_INCREF(x);
v = POP();
u = TOP();
if (PyInt_AsLong(u) != -1 || PyErr_Occurred())
res = PyInt_AsLong(u);
if (res != -1 || PyErr_Occurred()) {
if (res == -1) {
assert(PyErr_Occurred());
PyErr_Clear();
}
w = PyTuple_Pack(5,
w,
f->f_globals,
......@@ -2616,6 +2622,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_None : f->f_locals,
v,
u);
}
else
w = PyTuple_Pack(4,
w,
......
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