Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76c81ee

Browse files
committed
Don't stomp on an exception set by PyCell_Get()
1 parent 7b4c8e4 commit 76c81ee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Python/ceval.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,10 @@ eval_frame(PyFrameObject *f)
17341734
x = freevars[oparg];
17351735
w = PyCell_Get(x);
17361736
if (w == NULL) {
1737+
err = -1;
1738+
/* Don't stomp existing exception */
1739+
if (PyErr_Occurred())
1740+
break;
17371741
if (oparg < f->f_ncells) {
17381742
v = PyTuple_GetItem(co->co_cellvars,
17391743
oparg);
@@ -1750,7 +1754,6 @@ eval_frame(PyFrameObject *f)
17501754
UNBOUNDFREE_ERROR_MSG,
17511755
v);
17521756
}
1753-
err = -1;
17541757
break;
17551758
}
17561759
PUSH(w);

0 commit comments

Comments
 (0)