Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 41273:d428e21d6eaf
Fix refleak in compiler.
(A symbol table entry was leaked every time a class was compiled.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 21 Mar 2007 21:26:58 +0000 |
| parents | 19f7ff443718 |
| children | 060c79f6d919 |
line wrap: on
line diff
--- a/Python/compile.c Wed Mar 21 20:10:51 2007 +0000 +++ b/Python/compile.c Wed Mar 21 21:26:58 2007 +0000 @@ -1519,6 +1519,7 @@ PyCodeObject *co; PyObject *str; PySTEntryObject *ste; + int err; /* initialize statics */ if (build_class == NULL) { @@ -1547,7 +1548,9 @@ if (ste == NULL) return 0; 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; /* 1. compile the class body into a code object */
