[Python-checkins] CVS: python/dist/src/Python compile.c,2.193,2.194

Jeremy Hylton jhylton@users.sourceforge.net
Fri, 23 Mar 2001 06:08:40 -0800


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

Modified Files:
	compile.c 
Log Message:
Make it illegal to assign to __debug__ as per Guido's request.


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.193
retrieving revision 2.194
diff -C2 -r2.193 -r2.194
*** compile.c	2001/03/22 03:57:58	2.193
--- compile.c	2001/03/23 14:08:38	2.194
***************
*** 67,70 ****
--- 67,73 ----
  "from __future__ imports must occur at the beginning of the file"
  
+ #define ASSIGN_DEBUG \
+ "can not assign to __debug__"
+ 
  #define MANGLE_LEN 256
  
***************
*** 5182,5187 ****
  			n = CHILD(n, 1);
  			goto loop;
! 		} else if (TYPE(tmp) == NAME)
  			symtable_add_def(st, STR(tmp), DEF_LOCAL | flag);
  		return;
  	case dotted_as_name:
--- 5185,5198 ----
  			n = CHILD(n, 1);
  			goto loop;
! 		} else if (TYPE(tmp) == NAME) {
! 			if (strcmp(STR(tmp), "__debug__") == 0) {
! 				PyErr_SetString(PyExc_SyntaxError,
! 						ASSIGN_DEBUG);
!  				PyErr_SyntaxLocation(st->st_filename,
! 						   n->n_lineno);
! 				st->st_errors++;
! 			}
  			symtable_add_def(st, STR(tmp), DEF_LOCAL | flag);
+ 		}
  		return;
  	case dotted_as_name: