diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-05-16 19:37:25 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-05-16 19:37:25 (GMT) |
commit | e8e14591ebb729b4fa19626ce245fa0811cf6f32 (patch) | |
tree | 6448a655b30bd5f6d1f23137ebb5f8183547f109 /Python/compile.c | |
parent | e914123d1f07159f32bf4330556397ce4d590189 (diff) | |
download | cpython-e8e14591ebb729b4fa19626ce245fa0811cf6f32.zip cpython-e8e14591ebb729b4fa19626ce245fa0811cf6f32.tar.gz cpython-e8e14591ebb729b4fa19626ce245fa0811cf6f32.tar.bz2 |
rather than passing locals to the class body, just execute the class body in the proper environment
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/Python/compile.c b/Python/compile.c index 24ff61f..65043e4 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -893,8 +893,6 @@ opcode_stack_effect(int opcode, int oparg) 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 @@ compiler_class(struct compiler *c, stmt_ty s) 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 @@ compute_code_flags(struct compiler *c) { PySTEntryObject *ste = c->u->u_ste; int flags = 0, n; - if (ste->ste_type != ModuleBlock) - flags |= CO_NEWLOCALS; if (ste->ste_type == FunctionBlock) { + flags |= CO_NEWLOCALS; if (!ste->ste_unoptimized) flags |= CO_OPTIMIZED; if (ste->ste_nested) |