summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-06-28 15:40:50 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-06-28 15:40:50 (GMT)
commit176101d660cdb619c74476a71eb3bbf2c32a45ca (patch)
tree701c4537ce9a6c9b893104653b621e88bc59b013 /Python/ceval.c
parent9e0804f218a9901e8be42566bccedc84b4a3e4d5 (diff)
downloadcpython-176101d660cdb619c74476a71eb3bbf2c32a45ca.zip
cpython-176101d660cdb619c74476a71eb3bbf2c32a45ca.tar.gz
cpython-176101d660cdb619c74476a71eb3bbf2c32a45ca.tar.bz2
correctly rearrange the stack in the exception case of WITH_CLEANUP
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index b689f3d..24e4168 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2533,10 +2533,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
u = v = w = Py_None;
}
else {
+ PyObject *tp, *exc, *tb;
+ PyTryBlock *block;
v = SECOND();
w = THIRD();
+ tp = FOURTH();
+ exc = stack_pointer[-5];
+ tb = stack_pointer[-6];
exit_func = stack_pointer[-7];
- stack_pointer[-7] = NULL;
+ stack_pointer[-7] = tb;
+ stack_pointer[-6] = exc;
+ stack_pointer[-5] = tp;
+ FOURTH() = NULL;
+ block = &f->f_blockstack[f->f_iblock - 1];
+ assert(block->b_type == EXCEPT_HANDLER);
+ block->b_level--;
}
/* XXX Not the fastest way to call it... */
x = PyObject_CallFunctionObjArgs(exit_func, u, v, w,