Commit 3a383625 authored by Guido van Rossum's avatar Guido van Rossum

Fix refleak in compiler.

(A symbol table entry was leaked every time a class was compiled.)
parent 390d29ca
...@@ -1519,6 +1519,7 @@ compiler_class(struct compiler *c, stmt_ty s) ...@@ -1519,6 +1519,7 @@ compiler_class(struct compiler *c, stmt_ty s)
PyCodeObject *co; PyCodeObject *co;
PyObject *str; PyObject *str;
PySTEntryObject *ste; PySTEntryObject *ste;
int err;
/* initialize statics */ /* initialize statics */
if (build_class == NULL) { if (build_class == NULL) {
...@@ -1547,7 +1548,9 @@ compiler_class(struct compiler *c, stmt_ty s) ...@@ -1547,7 +1548,9 @@ compiler_class(struct compiler *c, stmt_ty s)
if (ste == NULL) if (ste == NULL)
return 0; return 0;
assert(PyList_Check(ste->ste_varnames)); assert(PyList_Check(ste->ste_varnames));
if (PyList_Append(ste->ste_varnames, locals) < 0) err = PyList_Append(ste->ste_varnames, locals);
Py_DECREF(ste);
if (err < 0)
return 0; return 0;
/* 1. compile the class body into a code object */ /* 1. compile the class body into a code object */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment