]> granicus.if.org Git - python/commitdiff
Since PyDict_GetItem() can't raise an exception any more, there's no
authorGuido van Rossum <guido@python.org>
Thu, 14 May 1998 02:16:20 +0000 (02:16 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 14 May 1998 02:16:20 +0000 (02:16 +0000)
need to call PyErr_Clear() when it returns NULL.

Python/ceval.c
Python/compile.c

index 7c358dbd934631faedd7dfad6f979b4a25ed0688..cffe89a5ece411af2e3aca1d3f9cbb1dadeceeb9 100644 (file)
@@ -1287,10 +1287,8 @@ eval_code2(co, globals, locals,
                        }
                        x = PyDict_GetItem(x, w);
                        if (x == NULL) {
-                               PyErr_Clear();
                                x = PyDict_GetItem(f->f_globals, w);
                                if (x == NULL) {
-                                       PyErr_Clear();
                                        x = PyDict_GetItem(f->f_builtins, w);
                                        if (x == NULL) {
                                                PyErr_SetObject(
@@ -1307,7 +1305,6 @@ eval_code2(co, globals, locals,
                        w = GETNAMEV(oparg);
                        x = PyDict_GetItem(f->f_globals, w);
                        if (x == NULL) {
-                               PyErr_Clear();
                                x = PyDict_GetItem(f->f_builtins, w);
                                if (x == NULL) {
                                        PyErr_SetObject(PyExc_NameError, w);
index 312600d896a6731c59c928cb5152174eecb5ab8c..422a2afd7f7af2c51b55e3008c5c234ec8954619 100644 (file)
@@ -3340,7 +3340,6 @@ optimize(c)
                        name = GETNAMEOBJ(oparg);
                        v = PyDict_GetItem(c->c_locals, name);
                        if (v == NULL) {
-                               PyErr_Clear();
                                if (opcode == LOAD_NAME &&
                                    (c->c_flags&CO_OPTIMIZED))
                                        cur_instr[0] = LOAD_GLOBAL;