]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Oops need to mangle global statement separately
authorGuido van Rossum <guido@python.org>
Sat, 24 Aug 1996 07:29:04 +0000 (07:29 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 24 Aug 1996 07:29:04 +0000 (07:29 +0000)
Python/compile.c

index 0ecf69c721b8d892b7d376132f0f5dc9484d3804..ad58606e01232836a8998445829c350bb3b4e723 100644 (file)
@@ -1779,6 +1779,13 @@ com_global_stmt(c, n)
        /* 'global' NAME (',' NAME)* */
        for (i = 1; i < NCH(n); i += 2) {
                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) {
                        err_setstr(SyntaxError, "name is local and global");
                        c->c_errors++;