diff Python/ceval.c @ 24190:a2bcb00dcbd5 legacy-trunk

Don't stomp on an exception set by PyCell_Get()
author Jeremy Hylton <jeremy@alum.mit.edu>
date Thu, 11 Jul 2002 16:56:38 +0000
parents dfa68668d00e
children e06b1ab0bdb8
line wrap: on
line diff
--- a/Python/ceval.c	Thu Jul 11 15:43:37 2002 +0000
+++ b/Python/ceval.c	Thu Jul 11 16:56:38 2002 +0000
@@ -1734,6 +1734,10 @@
 			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 @@
 					       UNBOUNDFREE_ERROR_MSG,
 					       v);
 				}
-				err = -1;
 				break;
 			}
 			PUSH(w);