Patch #1759: Backport of PEP 3129 class decorators

with some help from Georg
This commit is contained in:
Christian Heimes 2008-02-23 15:01:05 +00:00
parent b12f0b581a
commit 5224d28d38
15 changed files with 1591 additions and 1465 deletions

View file

@ -931,8 +931,8 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
return 0;
if (s->v.FunctionDef.args->defaults)
VISIT_SEQ(st, expr, s->v.FunctionDef.args->defaults);
if (s->v.FunctionDef.decorators)
VISIT_SEQ(st, expr, s->v.FunctionDef.decorators);
if (s->v.FunctionDef.decorator_list)
VISIT_SEQ(st, expr, s->v.FunctionDef.decorator_list);
if (!symtable_enter_block(st, s->v.FunctionDef.name,
FunctionBlock, (void *)s, s->lineno))
return 0;
@ -946,6 +946,8 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
if (!symtable_add_def(st, s->v.ClassDef.name, DEF_LOCAL))
return 0;
VISIT_SEQ(st, expr, s->v.ClassDef.bases);
if (s->v.ClassDef.decorator_list)
VISIT_SEQ(st, expr, s->v.ClassDef.decorator_list);
if (!symtable_enter_block(st, s->v.ClassDef.name, ClassBlock,
(void *)s, s->lineno))
return 0;