[Python-checkins] python/dist/src/Objects frameobject.c,2.69,2.70

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
2002年12月19日 10:17:00 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv23459/Objects
Modified Files:
	frameobject.c 
Log Message:
Fix bug introduced by SF patch #643835, Set Next Statement for Python debuggers
blockstack_top could be 0 when blockstack[blockstack_top-1]
was referenced (ie blockstack[-1]) which crashed on hpux.
Patch & fix by Richie Hindle
Index: frameobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v
retrieving revision 2.69
retrieving revision 2.70
diff -C2 -d -r2.69 -r2.70
*** frameobject.c	18 Dec 2002 23:33:35 -0000	2.69
--- frameobject.c	19 Dec 2002 18:16:57 -0000	2.70
***************
*** 185,188 ****
--- 185,189 ----
 
 		case POP_BLOCK:
+ 			assert(blockstack_top > 0);
 			setup_op = code[blockstack[blockstack_top-1]];
 			if (setup_op == SETUP_FINALLY) {
***************
*** 197,204 ****
 			/* Ignore END_FINALLYs for SETUP_EXCEPTs - they exist
 			 * in the bytecode but don't correspond to an actual
! 			 * 'finally' block. */
! 			setup_op = code[blockstack[blockstack_top-1]];
! 			if (setup_op == SETUP_FINALLY) {
! 				blockstack_top--;
 			}
 			break;
--- 198,208 ----
 			/* Ignore END_FINALLYs for SETUP_EXCEPTs - they exist
 			 * in the bytecode but don't correspond to an actual
! 			 * 'finally' block. (If blockstack_top is 0, we must
! 			 * be seeing such an END_FINALLY.) */
! 			if (blockstack_top > 0) {
! 				setup_op = code[blockstack[blockstack_top-1]];
! 				if (setup_op == SETUP_FINALLY) {
! 					blockstack_top--;
! 				}
 			}
 			break;
***************
*** 234,237 ****
--- 238,245 ----
 	}
 
+ 	/* Verify that the blockstack tracking code didn't get lost. */
+ 	assert(blockstack_top == 0);
+ 
+ 	/* After all that, are we jumping into / out of a 'finally' block? */
 	if (new_lasti_setup_addr != f_lasti_setup_addr) {
 		PyErr_SetString(PyExc_ValueError,

AltStyle によって変換されたページ (->オリジナル) /