diff Python/ceval.c @ 55034:6210dedd2cf7 legacy-trunk

small optimization: avoid popping the current block until we have to
author Benjamin Peterson <benjamin@python.org>
date Wed, 01 Jul 2009 23:45:19 +0000
parents 368478859fe3
children f594313b9364
line wrap: on
line diff
--- a/Python/ceval.c	Wed Jul 01 13:34:35 2009 +0000
+++ b/Python/ceval.c	Wed Jul 01 23:45:19 2009 +0000
@@ -2806,20 +2806,20 @@
 
 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);