]> granicus.if.org Git - python/commitdiff
Don't stomp on an exception set by PyCell_Get()
authorJeremy Hylton <jeremy@alum.mit.edu>
Thu, 11 Jul 2002 16:56:38 +0000 (16:56 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Thu, 11 Jul 2002 16:56:38 +0000 (16:56 +0000)
Python/ceval.c

index 7f7d37e0e608fa9f9ec7d8efff9855d52a94cb65..61db642f844e2a80c6bd231063c360d16706657c 100644 (file)
@@ -1734,6 +1734,10 @@ eval_frame(PyFrameObject *f)
                        x = freevars[oparg];
                        w = PyCell_Get(x);
                        if (w == NULL) {
+                               err = -1;
+                               /* Don't stomp existing exception */
+                               if (PyErr_Occurred())
+                                       break;
                                if (oparg < f->f_ncells) {
                                        v = PyTuple_GetItem(co->co_cellvars,
                                                               oparg);
@@ -1750,7 +1754,6 @@ eval_frame(PyFrameObject *f)
                                               UNBOUNDFREE_ERROR_MSG,
                                               v);
                                }
-                               err = -1;
                                break;
                        }
                        PUSH(w);