summaryrefslogtreecommitdiff
path: root/Python/symtable.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index d74f26fbe3..dc934a556d 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1175,6 +1175,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
VISIT_QUIT(st, 0);
}
if ((cur & (DEF_GLOBAL | DEF_NONLOCAL))
+ && (st->st_cur->ste_symbols != st->st_global)
&& s->v.AnnAssign.simple) {
PyErr_Format(PyExc_SyntaxError,
cur & DEF_GLOBAL ? GLOBAL_ANNOT : NONLOCAL_ANNOT,