diff Python/symtable.c @ 51959:d342a725b2d5

instead of hacking __locals__ in during bytecode generation, put it in the symtable
author Benjamin Peterson <benjamin@python.org>
date Tue, 03 Mar 2009 00:54:05 +0000
parents 87fbbf22adf3
children 2b436310fc8b
line wrap: on
line diff
--- a/Python/symtable.c	Tue Mar 03 00:23:19 2009 +0000
+++ b/Python/symtable.c	Tue Mar 03 00:54:05 2009 +0000
@@ -186,7 +186,8 @@
 
 
 static identifier top = NULL, lambda = NULL, genexpr = NULL,
-    listcomp = NULL, setcomp = NULL, dictcomp = NULL, __class__ = NULL;
+	listcomp = NULL, setcomp = NULL, dictcomp = NULL,
+	__class__ = NULL, __locals__ = NULL;
 
 #define GET_IDENTIFIER(VAR) \
 	((VAR) ? (VAR) : ((VAR) = PyUnicode_InternFromString(# VAR)))
@@ -1050,7 +1051,9 @@
 					  (void *)s, s->lineno))
 			return 0;
 		if (!GET_IDENTIFIER(__class__) ||
-		    !symtable_add_def(st, __class__, DEF_LOCAL)) {
+		    !symtable_add_def(st, __class__, DEF_LOCAL) ||
+		    !GET_IDENTIFIER(__locals__) ||
+		    !symtable_add_def(st, __locals__, DEF_PARAM)) {
 			symtable_exit_block(st, s);
 			return 0;
 		}