diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-04-30 13:41:40 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-04-30 13:41:40 (GMT) |
commit | 3b0431dc6019d2f9ffa9adcaa78ddd3f7b76a2f5 (patch) | |
tree | 7f98ecba2e560776b91856eb74487c26c73d5d0d /Python/compile.c | |
parent | f256f5f3ebf6574a2708cfea36d857846893e71f (diff) | |
download | cpython-3b0431dc6019d2f9ffa9adcaa78ddd3f7b76a2f5.zip cpython-3b0431dc6019d2f9ffa9adcaa78ddd3f7b76a2f5.tar.gz cpython-3b0431dc6019d2f9ffa9adcaa78ddd3f7b76a2f5.tar.bz2 |
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 52e8188..1ecbae8 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: |