mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
rather than passing locals to the class body, just execute the class body in the proper environment
This commit is contained in:
parent
e914123d1f
commit
e8e14591eb
10 changed files with 3143 additions and 3175 deletions
|
@ -192,7 +192,7 @@ static int symtable_visit_withitem(struct symtable *st, withitem_ty item);
|
|||
|
||||
static identifier top = NULL, lambda = NULL, genexpr = NULL,
|
||||
listcomp = NULL, setcomp = NULL, dictcomp = NULL,
|
||||
__class__ = NULL, __locals__ = NULL;
|
||||
__class__ = NULL;
|
||||
|
||||
#define GET_IDENTIFIER(VAR) \
|
||||
((VAR) ? (VAR) : ((VAR) = PyUnicode_InternFromString(# VAR)))
|
||||
|
@ -1185,11 +1185,6 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
|
|||
if (!symtable_enter_block(st, s->v.ClassDef.name, ClassBlock,
|
||||
(void *)s, s->lineno, s->col_offset))
|
||||
VISIT_QUIT(st, 0);
|
||||
if (!GET_IDENTIFIER(__locals__) ||
|
||||
!symtable_add_def(st, __locals__, DEF_PARAM)) {
|
||||
symtable_exit_block(st, s);
|
||||
VISIT_QUIT(st, 0);
|
||||
}
|
||||
tmp = st->st_private;
|
||||
st->st_private = s->v.ClassDef.name;
|
||||
VISIT_SEQ(st, stmt, s->v.ClassDef.body);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue