Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 51959:d342a725b2d5
instead of hacking __locals__ in during bytecode generation, put it in the symtable
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Tue, 03 Mar 2009 00:54:05 +0000 |
| parents | 643d8d4fc8eb |
| children | 911df82bc25d |
line wrap: on
line diff
--- a/Python/compile.c Tue Mar 03 00:23:19 2009 +0000 +++ b/Python/compile.c Tue Mar 03 00:54:05 2009 +0000 @@ -1524,23 +1524,14 @@ static int compiler_class(struct compiler *c, stmt_ty s) { - static PyObject *locals = NULL; PyCodeObject *co; PyObject *str; - PySTEntryObject *ste; - int err, i; + int i; asdl_seq* decos = s->v.ClassDef.decorator_list; if (!compiler_decorators(c, decos)) return 0; - /* initialize statics */ - if (locals == NULL) { - locals = PyUnicode_InternFromString("__locals__"); - if (locals == NULL) - return 0; - } - /* ultimately generate code for: <name> = __build_class__(<func>, <name>, *<bases>, **<keywords>) where: @@ -1553,16 +1544,6 @@ This borrows from compiler_call. */ - /* 0. Create a fake argument named __locals__ */ - ste = PySymtable_Lookup(c->c_st, s); - if (ste == NULL) - return 0; - assert(PyList_Check(ste->ste_varnames)); - err = PyList_Append(ste->ste_varnames, locals); - Py_DECREF(ste); - if (err < 0) - return 0; - /* 1. compile the class body into a code object */ if (!compiler_enter_scope(c, s->v.ClassDef.name, (void *)s, s->lineno)) return 0;
