[Python-checkins] python/dist/src/Parser parsetok.c,2.34,2.35

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Thu, 13 Feb 2003 14:08:01 -0800


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

Modified Files:
	parsetok.c 
Log Message:
- Finally fixed the bug in compile() and exec where a string ending
  with an indented code block but no newline would raise SyntaxError.
  This would have been a four-line change in parsetok.c...  Except
  codeop.py depends on this behavior, so a compilation flag had to be
  invented that causes the tokenizer to revert to the old behavior;
  this required extra changes to 2 .h files, 2 .c files, and 2 .py
  files.  (Fixes SF bug #501622.)


Index: parsetok.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Parser/parsetok.c,v
retrieving revision 2.34
retrieving revision 2.35
diff -C2 -d -r2.34 -r2.35
*** parsetok.c	11 Dec 2002 14:04:58 -0000	2.34
--- parsetok.c	13 Feb 2003 22:07:58 -0000	2.35
***************
*** 131,134 ****
--- 131,143 ----
  			type = NEWLINE; /* Add an extra newline */
  			started = 0;
+ 			/* Add the right number of dedent tokens,
+ 			   except if a certain flag is given --
+ 			   codeop.py uses this. */
+ 			if (tok->indent &&
+ 			    !(flags & PyPARSE_DONT_IMPLY_DEDENT))
+ 			{
+ 				tok->pendin = -tok->indent;
+ 				tok->indent = 0;
+ 			}
  		}
  		else