From: Guido van Rossum Date: Thu, 14 May 1998 02:16:20 +0000 (+0000) Subject: Since PyDict_GetItem() can't raise an exception any more, there's no X-Git-Tag: v1.5.2a1~645 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=234e260d5ed827364c733bf086d68c4395c0d9e6;p=thirdparty%2FPython%2Fcpython.git Since PyDict_GetItem() can't raise an exception any more, there's no need to call PyErr_Clear() when it returns NULL. --- diff --git a/Python/ceval.c b/Python/ceval.c index 7c358dbd9346..cffe89a5ece4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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); diff --git a/Python/compile.c b/Python/compile.c index 312600d896a6..422a2afd7f7a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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;