summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 93cfb641e0..61e22d10fe 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -2731,7 +2731,8 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
optype = OP_FAST;
break;
case GLOBAL_IMPLICIT:
- if (!c->u->u_ste->ste_unoptimized)
+ if (c->u->u_ste->ste_type == FunctionBlock &&
+ !c->u->u_ste->ste_unoptimized)
optype = OP_GLOBAL;
break;
case GLOBAL_EXPLICIT: