Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 54903:544c5bad1607
correctly rearrange the stack in the exception case of WITH_CLEANUP
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sun, 28 Jun 2009 15:40:50 +0000 |
| parents | 3aaf2e065db0 |
| children | 2602b56ad02d |
line wrap: on
line diff
--- a/Python/ceval.c Sun Jun 28 13:21:41 2009 +0000 +++ b/Python/ceval.c Sun Jun 28 15:40:50 2009 +0000 @@ -2533,10 +2533,21 @@ 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,
