diff Python/ceval.c @ 25631:85062a12c24f 2.2

This is Armin Rigo's patch: [ 617312 ] debugger-controlled jumps (Psyco #3) Forward port candidate, I guess.
author Michael W. Hudson <mwh@python.net>
date Mon, 07 Oct 2002 09:37:26 +0000
parents 75e5a2a71729
children 4ca32e4f7839
line wrap: on
line diff
--- a/Python/ceval.c	Mon Oct 07 06:22:21 2002 +0000
+++ b/Python/ceval.c	Mon Oct 07 09:37:26 2002 +0000
@@ -585,14 +585,6 @@
 	}
 
 	tstate->frame = f;
-	co = f->f_code;
-	fastlocals = f->f_localsplus;
-	freevars = f->f_localsplus + f->f_nlocals;
-	_PyCode_GETCODEPTR(co, &first_instr);
-	next_instr = first_instr + f->f_lasti;
-	stack_pointer = f->f_stacktop;
-	assert(stack_pointer != NULL);
-	f->f_stacktop = NULL;	/* remains NULL unless yield suspends frame */
 
 	if (tstate->use_tracing) {
 		if (tstate->c_tracefunc != NULL) {
@@ -631,6 +623,15 @@
 		}
 	}
 
+	co = f->f_code;
+	fastlocals = f->f_localsplus;
+	freevars = f->f_localsplus + f->f_nlocals;
+	_PyCode_GETCODEPTR(co, &first_instr);
+	next_instr = first_instr + f->f_lasti;
+	stack_pointer = f->f_stacktop;
+	assert(stack_pointer != NULL);
+	f->f_stacktop = NULL;	/* remains NULL unless yield suspends frame */
+
 #ifdef LLTRACE
 	lltrace = PyDict_GetItemString(f->f_globals,"__lltrace__") != NULL;
 #endif
@@ -1972,6 +1973,7 @@
 				continue;
 			/* Trace each line of code reached */
 			f->f_lasti = INSTR_OFFSET();
+			f->f_stacktop = stack_pointer;
 			/* Inline call_trace() for performance: */
 			tstate->tracing++;
 			tstate->use_tracing = 0;
@@ -1980,6 +1982,11 @@
 			tstate->use_tracing = (tstate->c_tracefunc
 					       || tstate->c_profilefunc);
 			tstate->tracing--;
+			/* Reload possibly changed frame fields */
+			JUMPTO(f->f_lasti);
+			stack_pointer = f->f_stacktop;
+			assert(stack_pointer != NULL);
+			f->f_stacktop = NULL;
 			break;
 
 		case CALL_FUNCTION: