diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-04-30 09:41:40 -0400 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-04-30 09:41:40 -0400 |
commit | a2fc2ebe3d645e60d26996b51d8b33a1fe177d5c (patch) | |
tree | 1ea3e6bd538e2171a60e96ba1656a3457e129599 /Python/compile.c | |
parent | c6666f2ecc6dfd60aa6fe88950c5dfb2eb8d6687 (diff) | |
download | cpython-a2fc2ebe3d645e60d26996b51d8b33a1fe177d5c.tar.gz |
check local class namespace before reaching for cells (closes #17853)
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c index 52e8188d41..1ecbae8181 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -970,6 +970,7 @@ opcode_stack_effect(int opcode, int oparg) case LOAD_CLOSURE: return 1; case LOAD_DEREF: + case LOAD_CLASSDEREF: return 1; case STORE_DEREF: return -1; @@ -2677,7 +2678,9 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx) switch (optype) { case OP_DEREF: switch (ctx) { - case Load: op = LOAD_DEREF; break; + case Load: + op = (c->u->u_ste->ste_type == ClassBlock) ? LOAD_CLASSDEREF : LOAD_DEREF; + break; case Store: op = STORE_DEREF; break; case AugLoad: case AugStore: |