Patch #792869: Clarify error message for parameters declared global,

rename LOCAL_GLOBAL to PARAM_GLOBAL.
This commit is contained in:
Martin v. Löwis 2003-10-18 22:05:25 +00:00
parent 0f0c06a5c2
commit dd7eb146a8
1 changed files with 3 additions and 4 deletions

View File

@ -60,7 +60,7 @@ int Py_OptimizeFlag = 0;
#define GLOBAL_AFTER_USE \ #define GLOBAL_AFTER_USE \
"name '%.400s' is used prior to global declaration" "name '%.400s' is used prior to global declaration"
#define LOCAL_GLOBAL \ #define PARAM_GLOBAL \
"name '%.400s' is a function parameter and declared global" "name '%.400s' is a function parameter and declared global"
#define LATE_FUTURE \ #define LATE_FUTURE \
@ -4843,7 +4843,7 @@ symtable_load_symbols(struct compiling *c)
c->c_argcount--; c->c_argcount--;
else if (flags & DEF_GLOBAL) { else if (flags & DEF_GLOBAL) {
if (flags & DEF_PARAM) { if (flags & DEF_PARAM) {
PyErr_Format(PyExc_SyntaxError, LOCAL_GLOBAL, PyErr_Format(PyExc_SyntaxError, PARAM_GLOBAL,
PyString_AS_STRING(name)); PyString_AS_STRING(name));
symtable_error(st, 0); symtable_error(st, 0);
goto fail; goto fail;
@ -5592,8 +5592,7 @@ symtable_global(struct symtable *st, node *n)
if (flags && flags != DEF_GLOBAL) { if (flags && flags != DEF_GLOBAL) {
char buf[500]; char buf[500];
if (flags & DEF_PARAM) { if (flags & DEF_PARAM) {
PyErr_Format(PyExc_SyntaxError, PyErr_Format(PyExc_SyntaxError, PARAM_GLOBAL,
"name '%.400s' is local and global",
name); name);
symtable_error(st, 0); symtable_error(st, 0);
return; return;