Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd7eb14

Browse files
committed
Patch #792869: Clarify error message for parameters declared global,
rename LOCAL_GLOBAL to PARAM_GLOBAL.
1 parent 0f0c06a commit dd7eb14

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Python/compile.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int Py_OptimizeFlag = 0;
6060
#define GLOBAL_AFTER_USE \
6161
"name '%.400s' is used prior to global declaration"
6262

63-
#define LOCAL_GLOBAL \
63+
#define PARAM_GLOBAL \
6464
"name '%.400s' is a function parameter and declared global"
6565

6666
#define LATE_FUTURE \
@@ -4843,7 +4843,7 @@ symtable_load_symbols(struct compiling *c)
48434843
c->c_argcount--;
48444844
else if (flags & DEF_GLOBAL) {
48454845
if (flags & DEF_PARAM) {
4846-
PyErr_Format(PyExc_SyntaxError, LOCAL_GLOBAL,
4846+
PyErr_Format(PyExc_SyntaxError, PARAM_GLOBAL,
48474847
PyString_AS_STRING(name));
48484848
symtable_error(st, 0);
48494849
goto fail;
@@ -5592,8 +5592,7 @@ symtable_global(struct symtable *st, node *n)
55925592
if (flags && flags != DEF_GLOBAL) {
55935593
char buf[500];
55945594
if (flags & DEF_PARAM) {
5595-
PyErr_Format(PyExc_SyntaxError,
5596-
"name '%.400s' is local and global",
5595+
PyErr_Format(PyExc_SyntaxError, PARAM_GLOBAL,
55975596
name);
55985597
symtable_error(st, 0);
55995598
return;

0 commit comments

Comments
 (0)