summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-04-30 09:41:40 -0400
committerBenjamin Peterson <benjamin@python.org>2013-04-30 09:41:40 -0400
commita2fc2ebe3d645e60d26996b51d8b33a1fe177d5c (patch)
tree1ea3e6bd538e2171a60e96ba1656a3457e129599 /Python/compile.c
parentc6666f2ecc6dfd60aa6fe88950c5dfb2eb8d6687 (diff)
downloadcpython-a2fc2ebe3d645e60d26996b51d8b33a1fe177d5c.tar.gz
check local class namespace before reaching for cells (closes #17853)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
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: