diff Python/compile.c @ 83572:cf65c7a75f55

check local class namespace before reaching for cells (closes #17853)
author Benjamin Peterson <benjamin@python.org>
date Tue, 30 Apr 2013 09:41:40 -0400
parents 937ba7bb2285
children 3d858f1eef54
line wrap: on
line diff
--- a/Python/compile.c	Tue Apr 30 16:34:30 2013 +0300
+++ b/Python/compile.c	Tue Apr 30 09:41:40 2013 -0400
@@ -970,6 +970,7 @@
         case LOAD_CLOSURE:
             return 1;
         case LOAD_DEREF:
+        case LOAD_CLASSDEREF:
             return 1;
         case STORE_DEREF:
             return -1;
@@ -2677,7 +2678,9 @@
     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: