mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
Oops need to mangle global statement separately
This commit is contained in:
parent
8ff077b094
commit
fe2236f3c8
1 changed files with 7 additions and 0 deletions
|
|
@ -1779,6 +1779,13 @@ com_global_stmt(c, n)
|
||||||
/* 'global' NAME (',' NAME)* */
|
/* 'global' NAME (',' NAME)* */
|
||||||
for (i = 1; i < NCH(n); i += 2) {
|
for (i = 1; i < NCH(n); i += 2) {
|
||||||
char *s = STR(CHILD(n, i));
|
char *s = STR(CHILD(n, i));
|
||||||
|
#ifdef PRIVATE_NAME_MANGLING
|
||||||
|
char buffer[256];
|
||||||
|
if (s != NULL && s[0] == '_' && s[1] == '_' &&
|
||||||
|
c->c_private != NULL &&
|
||||||
|
com_mangle(c, s, buffer, (int)sizeof(buffer)))
|
||||||
|
s = buffer;
|
||||||
|
#endif
|
||||||
if (dictlookup(c->c_locals, s) != NULL) {
|
if (dictlookup(c->c_locals, s) != NULL) {
|
||||||
err_setstr(SyntaxError, "name is local and global");
|
err_setstr(SyntaxError, "name is local and global");
|
||||||
c->c_errors++;
|
c->c_errors++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue