[Python-checkins] python/dist/src/Python compile.c,2.261,2.262
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Thu, 15 Aug 2002 19:48:13 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv20939
Modified Files:
compile.c
Log Message:
Add warnings for arguments named None. All set. (I could add a
warning for 'global None', but that's either accompanied by an
assignment to None, which will trigger a warning, or not, in which
case it's harmless. :-)
Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.261
retrieving revision 2.262
diff -C2 -d -r2.261 -r2.262
*** compile.c 16 Aug 2002 02:24:56 -0000 2.261
--- compile.c 16 Aug 2002 02:48:11 -0000 2.262
***************
*** 5026,5029 ****
--- 5026,5037 ----
int ret;
+ /* Warn about None, except inside a tuple (where the assignment
+ code already issues a warning). */
+ if ((flag & DEF_PARAM) && !(flag & DEF_INTUPLE) &&
+ *name == 'N' && strcmp(name, "None") == 0)
+ {
+ if (symtable_warn(st, "argument named None"))
+ return -1;
+ }
if (_Py_Mangle(st->st_private, name, buffer, sizeof(buffer)))
name = buffer;
***************
*** 5311,5315 ****
/* The next two functions parse the argument tuple.
! symtable_default_arg() checks for names in the default arguments,
which are references in the defining scope. symtable_params()
parses the parameter names, which are defined in the function's
--- 5319,5323 ----
/* The next two functions parse the argument tuple.
! symtable_default_args() checks for names in the default arguments,
which are references in the defining scope. symtable_params()
parses the parameter names, which are defined in the function's