summaryrefslogtreecommitdiff
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-03-03 00:54:05 +0000
committerBenjamin Peterson <benjamin@python.org>2009-03-03 00:54:05 +0000
commita8e085b4a22aceea6fa07b46804dcc8c2affcd86 (patch)
tree2acc7169058b58ebaf34655a12f9ef932022644d /Python/symtable.c
parent417230d03dec4652a730c46a7270e53799c9daf8 (diff)
downloadcpython-a8e085b4a22aceea6fa07b46804dcc8c2affcd86.tar.gz
instead of hacking __locals__ in during bytecode generation, put it in the symtable
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 17876ea0eb..732b85cf17 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -186,7 +186,8 @@ static int symtable_visit_annotations(struct symtable *st, stmt_ty s);
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 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
(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;
}