[Python-checkins] python/dist/src/Python ceval.c,2.311,2.312

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 11 Jun 2002 20:45:23 -0700


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

Modified Files:
	ceval.c 
Log Message:
SF bug 567538: Generator can crash the interpreter (Finn Bock).

This was a simple typo.  Strange that the compiler didn't catch it!
Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a
why_code at all, but an opcode; but even though 'why' is declared as
an enum, comparing it to an int is apparently not even worth a
warning -- not in gcc, and not in VC++. :-(

Will fix in 2.2 too.


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.311
retrieving revision 2.312
diff -C2 -d -r2.311 -r2.312
*** ceval.c	20 May 2002 13:56:11 -0000	2.311
--- ceval.c	12 Jun 2002 03:45:21 -0000	2.312
***************
*** 1544,1548 ****
  				if (why == WHY_RETURN ||
  				    why == WHY_YIELD ||
! 				    why == CONTINUE_LOOP)
  					retval = POP();
  			}
--- 1544,1548 ----
  				if (why == WHY_RETURN ||
  				    why == WHY_YIELD ||
! 				    why == WHY_CONTINUE)
  					retval = POP();
  			}
***************
*** 2294,2298 ****
  				else {
  					if (why == WHY_RETURN ||
! 					    why == CONTINUE_LOOP)
  						PUSH(retval);
  					v = PyInt_FromLong((long)why);
--- 2294,2298 ----
  				else {
  					if (why == WHY_RETURN ||
! 					    why == WHY_CONTINUE)
  						PUSH(retval);
  					v = PyInt_FromLong((long)why);