mirror of
https://github.com/python/cpython.git
synced 2025-10-23 07:02:24 +00:00
correctly rearrange the stack in the exception case of WITH_CLEANUP
This commit is contained in:
parent
9e0804f218
commit
176101d660
1 changed files with 12 additions and 1 deletions
|
@ -2533,10 +2533,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
u = v = w = Py_None;
|
u = v = w = Py_None;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
PyObject *tp, *exc, *tb;
|
||||||
|
PyTryBlock *block;
|
||||||
v = SECOND();
|
v = SECOND();
|
||||||
w = THIRD();
|
w = THIRD();
|
||||||
|
tp = FOURTH();
|
||||||
|
exc = stack_pointer[-5];
|
||||||
|
tb = stack_pointer[-6];
|
||||||
exit_func = stack_pointer[-7];
|
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... */
|
/* XXX Not the fastest way to call it... */
|
||||||
x = PyObject_CallFunctionObjArgs(exit_func, u, v, w,
|
x = PyObject_CallFunctionObjArgs(exit_func, u, v, w,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue