summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-07-01 23:45:19 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-07-01 23:45:19 (GMT)
commit4a3cf191f477f81cd14a28b2f7fdd3c7d9cfbd13 (patch)
tree65bfe4c28206468d4a108adf4190422de7922f09 /Python
parent4f24767938f5793c4d6edd72d24bb99abd9ccf77 (diff)
downloadcpython-4a3cf191f477f81cd14a28b2f7fdd3c7d9cfbd13.zip
cpython-4a3cf191f477f81cd14a28b2f7fdd3c7d9cfbd13.tar.gz
cpython-4a3cf191f477f81cd14a28b2f7fdd3c7d9cfbd13.tar.bz2
small optimization: avoid popping the current block until we have to
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index f80778c..ea4bd05 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2806,20 +2806,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
fast_block_end:
while (why != WHY_NOT && f->f_iblock > 0) {
- PyTryBlock *b = PyFrame_BlockPop(f);
+ /* Peek at the current block. */
+ PyTryBlock *b = &f->f_blockstack[f->f_iblock - 1];
assert(why != WHY_YIELD);
if (b->b_type == SETUP_LOOP && why == WHY_CONTINUE) {
- /* For a continue inside a try block,
- don't pop the block for the loop. */
- PyFrame_BlockSetup(f, b->b_type, b->b_handler,
- b->b_level);
why = WHY_NOT;
JUMPTO(PyInt_AS_LONG(retval));
Py_DECREF(retval);
break;
}
+ /* Now we have to pop the block. */
+ f->f_iblock--;
+
while (STACK_LEVEL() > b->b_level) {
v = POP();
Py_XDECREF(v);