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

Skip to content

Commit fe2236f

Browse files
committed
Oops need to mangle global statement separately
1 parent 8ff077b commit fe2236f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Python/compile.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,13 @@ com_global_stmt(c, n)
17791779
/* 'global' NAME (',' NAME)* */
17801780
for (i = 1; i < NCH(n); i += 2) {
17811781
char *s = STR(CHILD(n, i));
1782+
#ifdef PRIVATE_NAME_MANGLING
1783+
char buffer[256];
1784+
if (s != NULL && s[0] == '_' && s[1] == '_' &&
1785+
c->c_private != NULL &&
1786+
com_mangle(c, s, buffer, (int)sizeof(buffer)))
1787+
s = buffer;
1788+
#endif
17821789
if (dictlookup(c->c_locals, s) != NULL) {
17831790
err_setstr(SyntaxError, "name is local and global");
17841791
c->c_errors++;

0 commit comments

Comments
 (0)