[Python-checkins] python/dist/src/Python ceval.c,2.369,2.370

arigo at users.sourceforge.net arigo at users.sourceforge.net
Sat Oct 25 10:33:11 EDT 2003


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

Modified Files:
	ceval.c 
Log Message:
oh dear. Wrong manipulation. Committed a version of ceval.c from my 
no-cyclic-comparison patch at the same time as errors.c.

Reverting ceval.c to the previous revision.


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.369
retrieving revision 2.370
diff -C2 -d -r2.369 -r2.370
*** ceval.c	25 Oct 2003 14:29:27 -0000	2.369
--- ceval.c	25 Oct 2003 14:33:09 -0000	2.370
***************
*** 511,537 ****
  }
  
- int
- _Py_CheckRecursiveCall(char *where)
- {
- 	PyThreadState *tstate = PyThreadState_GET();
- 
- #ifdef USE_STACKCHECK
- 	if (PyOS_CheckStack()) {
- 		--tstate->recursion_depth;
- 		PyErr_SetString(PyExc_MemoryError, "Stack overflow");
- 		return -1;
- 	}
- #endif
- 	if (tstate->recursion_depth > recursion_limit) {
- 		--tstate->recursion_depth;
- 		PyErr_Format(PyExc_RuntimeError,
- 			     "maximum recursion depth exceeded%s",
- 			     where);
- 		return -1;
- 	}
- 	return 0;
- }
- 
- 
  /* Status code for main loop (reason for stack unwind) */
  
--- 511,514 ----
***************
*** 698,704 ****
  		return NULL;
  
  	/* push frame */
! 	if (Py_EnterRecursiveCall(""))
  		return NULL;
  
  	tstate->frame = f;
--- 675,693 ----
  		return NULL;
  
+ #ifdef USE_STACKCHECK
+ 	if (tstate->recursion_depth%10 == 0 && PyOS_CheckStack()) {
+ 		PyErr_SetString(PyExc_MemoryError, "Stack overflow");
+ 		return NULL;
+ 	}
+ #endif
+ 
  	/* push frame */
! 	if (++tstate->recursion_depth > recursion_limit) {
! 		--tstate->recursion_depth;
! 		PyErr_SetString(PyExc_RuntimeError,
! 				"maximum recursion depth exceeded");
! 		tstate->frame = f->f_back;
  		return NULL;
+ 	}
  
  	tstate->frame = f;
***************
*** 722,726 ****
  				       f, PyTrace_CALL, Py_None)) {
  				/* Trace function raised an error */
! 				goto exit_eval_frame;
  			}
  		}
--- 711,717 ----
  				       f, PyTrace_CALL, Py_None)) {
  				/* Trace function raised an error */
! 				--tstate->recursion_depth;
! 				tstate->frame = f->f_back;
! 				return NULL;
  			}
  		}
***************
*** 732,736 ****
  				       f, PyTrace_CALL, Py_None)) {
  				/* Profile function raised an error */
! 				goto exit_eval_frame;
  			}
  		}
--- 723,729 ----
  				       f, PyTrace_CALL, Py_None)) {
  				/* Profile function raised an error */
! 				--tstate->recursion_depth;
! 				tstate->frame = f->f_back;
! 				return NULL;
  			}
  		}
***************
*** 2436,2441 ****
  
  	/* pop frame */
!     exit_eval_frame:
! 	Py_LeaveRecursiveCall();
  	tstate->frame = f->f_back;
  
--- 2429,2433 ----
  
  	/* pop frame */
! 	--tstate->recursion_depth;
  	tstate->frame = f->f_back;
  





More information about the Python-checkins mailing list