summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorXiang Zhang <angwerzx@126.com>2018-03-09 02:21:58 (GMT)
committerGitHub <noreply@github.com>2018-03-09 02:21:58 (GMT)
commit34bb88dc5bc447832db8c7ccdc173311e0685eab (patch)
treea6d1ebfa9aaa25178a0b501163236df065ebae21 /Python
parent55d5bfba9482d39080f7b9ec3e6257ecd23f264f (diff)
downloadcpython-34bb88dc5bc447832db8c7ccdc173311e0685eab.zip
cpython-34bb88dc5bc447832db8c7ccdc173311e0685eab.tar.gz
cpython-34bb88dc5bc447832db8c7ccdc173311e0685eab.tar.bz2
Clear possible exception before calling PyTuple_Pack in IMPORT_NAME (GH-6033)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index bae158d..b55b4d6 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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,