[Python-checkins] CVS: python/dist/src/Python ceval.c,2.272,2.273

Neil Schemenauer nascheme@users.sourceforge.net
Tue, 04 Sep 2001 12:03:38 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv27436/Python

Modified Files:
	ceval.c 
Log Message:
Move call_trace(..., PyTrace_CALL, ...) call to top of eval_frame.  That
way it's called each time a generator is resumed.  The tracing of normal
functions should be unaffected by this change.


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.272
retrieving revision 2.273
diff -C2 -d -r2.272 -r2.273
*** ceval.c	2001/08/30 16:06:23	2.272
--- ceval.c	2001/09/04 19:03:35	2.273
***************
*** 589,592 ****
--- 589,627 ----
  	f->f_stacktop = NULL;
  
+ 	if (tstate->use_tracing) {
+ 		if (tstate->c_tracefunc != NULL) {
+ 			/* tstate->c_tracefunc, if defined, is a
+ 			   function that will be called on *every* entry
+ 			   to a code block.  Its return value, if not
+ 			   None, is a function that will be called at
+ 			   the start of each executed line of code.
+ 			   (Actually, the function must return itself
+ 			   in order to continue tracing.)  The trace
+ 			   functions are called with three arguments:
+ 			   a pointer to the current frame, a string
+ 			   indicating why the function is called, and
+ 			   an argument which depends on the situation.
+ 			   The global trace function is also called
+ 			   whenever an exception is detected. */
+ 			if (call_trace(tstate->c_tracefunc, tstate->c_traceobj,
+ 				       f, PyTrace_CALL, Py_None)) {
+ 				/* XXX Need way to compute arguments?? */
+ 				/* Trace function raised an error */
+ 				return NULL;
+ 			}
+ 		}
+ 		if (tstate->c_profilefunc != NULL) {
+ 			/* Similar for c_profilefunc, except it needn't
+ 			   return itself and isn't called for "line" events */
+ 			if (call_trace(tstate->c_profilefunc,
+ 				       tstate->c_profileobj,
+ 				       f, PyTrace_CALL, Py_None)) {
+ 				/* XXX Need way to compute arguments?? */
+ 				/* Profile function raised an error */
+ 				return NULL;
+ 			}
+ 		}
+ 	}
+ 
  #ifdef LLTRACE
  	lltrace = PyDict_GetItemString(f->f_globals,"__lltrace__") != NULL;
***************
*** 2494,2532 ****
  			Py_INCREF(o);
  			freevars[f->f_ncells + i] = o;
- 		}
- 	}
- 
- 	if (tstate->use_tracing) {
- 		if (tstate->c_tracefunc != NULL) {
- 			/* tstate->c_tracefunc, if defined, is a
- 			   function that will be called on *every* entry
- 			   to a code block.  Its return value, if not
- 			   None, is a function that will be called at
- 			   the start of each executed line of code.
- 			   (Actually, the function must return itself
- 			   in order to continue tracing.)  The trace
- 			   functions are called with three arguments:
- 			   a pointer to the current frame, a string
- 			   indicating why the function is called, and
- 			   an argument which depends on the situation.
- 			   The global trace function is also called
- 			   whenever an exception is detected. */
- 			if (call_trace(tstate->c_tracefunc, tstate->c_traceobj,
- 				       f, PyTrace_CALL, Py_None)) {
- 				/* XXX Need way to compute arguments?? */
- 				/* Trace function raised an error */
- 				goto fail;
- 			}
- 		}
- 		if (tstate->c_profilefunc != NULL) {
- 			/* Similar for c_profilefunc, except it needn't
- 			   return itself and isn't called for "line" events */
- 			if (call_trace(tstate->c_profilefunc,
- 				       tstate->c_profileobj,
- 				       f, PyTrace_CALL, Py_None)) {
- 				/* XXX Need way to compute arguments?? */
- 				/* Profile function raised an error */
- 				goto fail;
- 			}
  		}
  	}
--- 2529,2532 ----