diff Python/compile.c @ 83791:6db3741e59be

rather than passing locals to the class body, just execute the class body in the proper environment
author Benjamin Peterson <benjamin@python.org>
date Thu, 16 May 2013 14:37:25 -0500
parents 3d858f1eef54
children d1ba1228a04f
line wrap: on
line diff
--- a/Python/compile.c	Thu May 16 12:03:40 2013 -0500
+++ b/Python/compile.c	Thu May 16 14:37:25 2013 -0500
@@ -893,8 +893,6 @@
             return 7;
         case WITH_CLEANUP:
             return -1; /* XXX Sometimes more */
-        case STORE_LOCALS:
-            return -1;
         case RETURN_VALUE:
             return -1;
         case IMPORT_STAR:
@@ -1696,12 +1694,6 @@
         Py_INCREF(s->v.ClassDef.name);
         Py_XDECREF(c->u->u_private);
         c->u->u_private = s->v.ClassDef.name;
-        /* force it to have one mandatory argument */
-        c->u->u_argcount = 1;
-        /* load the first argument (__locals__) ... */
-        ADDOP_I(c, LOAD_FAST, 0);
-        /* ... and store it into f_locals */
-        ADDOP_IN_SCOPE(c, STORE_LOCALS);
         /* load (global) __name__ ... */
         str = PyUnicode_InternFromString("__name__");
         if (!str || !compiler_nameop(c, str, Load)) {
@@ -4110,9 +4102,8 @@
 {
     PySTEntryObject *ste = c->u->u_ste;
     int flags = 0, n;
-    if (ste->ste_type != ModuleBlock)
+    if (ste->ste_type == FunctionBlock) {
         flags |= CO_NEWLOCALS;
-    if (ste->ste_type == FunctionBlock) {
         if (!ste->ste_unoptimized)
             flags |= CO_OPTIMIZED;
         if (ste->ste_nested)