[Python-checkins] python/dist/src/Python ceval.c,2.340,2.341

mwh@users.sourceforge.net mwh@users.sourceforge.net
Fri, 08 Nov 2002 05:08:50 -0800


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

Modified Files:
	ceval.c 
Log Message:
This is Richie Hindle's patch:

[ 631276 ] Exceptions raised by line trace function

It conflicted with the patches from Armin I just checked it, so I had
to so some bits by hand.



Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.340
retrieving revision 2.341
diff -C2 -d -r2.340 -r2.341
*** ceval.c	8 Nov 2002 12:53:10 -0000	2.340
--- ceval.c	8 Nov 2002 13:08:46 -0000	2.341
***************
*** 52,56 ****
  				 PyFrameObject *, int);
  static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *);
! static void maybe_call_line_trace(Py_tracefunc, PyObject *, 
  				  PyFrameObject *, int *, int *);
  
--- 52,56 ----
  				 PyFrameObject *, int);
  static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *);
! static int maybe_call_line_trace(Py_tracefunc, PyObject *, 
  				  PyFrameObject *, int *, int *);
  
***************
*** 727,733 ****
  			   for expository comments */
  			f->f_stacktop = stack_pointer;
! 			maybe_call_line_trace(tstate->c_tracefunc,
! 					      tstate->c_traceobj,
! 					      f, &instr_lb, &instr_ub);
  			/* Reload possibly changed frame fields */
  			JUMPTO(f->f_lasti);
--- 727,738 ----
  			   for expository comments */
  			f->f_stacktop = stack_pointer;
! 			
! 			if (maybe_call_line_trace(tstate->c_tracefunc,
! 						  tstate->c_traceobj,
! 						  f, &instr_lb, &instr_ub)) {
! 				/* trace function raised an exception */
! 				why = WHY_EXCEPTION;
! 				goto on_error;
! 			}
  			/* Reload possibly changed frame fields */
  			JUMPTO(f->f_lasti);
***************
*** 2873,2877 ****
  }
  
! static void
  maybe_call_line_trace(Py_tracefunc func, PyObject *obj, 
  		      PyFrameObject *frame, int *instr_lb, int *instr_ub)
--- 2878,2882 ----
  }
  
! static int
  maybe_call_line_trace(Py_tracefunc func, PyObject *obj, 
  		      PyFrameObject *frame, int *instr_lb, int *instr_ub)
***************
*** 2948,2951 ****
--- 2953,2958 ----
  	*/
  
+ 	int result = 0;
+ 
  	if ((frame->f_lasti < *instr_lb || frame->f_lasti >= *instr_ub)) {
  		PyCodeObject* co = frame->f_code;
***************
*** 2981,2986 ****
  		if (addr == frame->f_lasti) {
  			frame->f_lineno = line;
! 			call_trace(func, obj, frame, 
! 				   PyTrace_LINE, Py_None);
  		}
  
--- 2988,2993 ----
  		if (addr == frame->f_lasti) {
  			frame->f_lineno = line;
! 			result = call_trace(func, obj, frame, 
! 					    PyTrace_LINE, Py_None);
  		}
  
***************
*** 2997,3000 ****
--- 3004,3009 ----
  		}
  	}
+ 
+ 	return result;
  }