diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-03 00:54:05 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-03 00:54:05 (GMT) |
commit | dcaf329e40923d22aefefeaf48babd422a5ad384 (patch) | |
tree | 2a30f6563ab11720edeba7abcdab44c346c987c4 /Python/compile.c | |
parent | 231b7f1cd6c8a29fcea4f6910f75647e05ae3a24 (diff) | |
download | cpython-dcaf329e40923d22aefefeaf48babd422a5ad384.zip cpython-dcaf329e40923d22aefefeaf48babd422a5ad384.tar.gz cpython-dcaf329e40923d22aefefeaf48babd422a5ad384.tar.bz2 |
instead of hacking __locals__ in during bytecode generation, put it in the symtable
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/Python/compile.c b/Python/compile.c index 8fae9d7..95ebd76 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1524,23 +1524,14 @@ compiler_function(struct compiler *c, stmt_ty s) 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 @@ compiler_class(struct compiler *c, stmt_ty s) 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; |