mirror of
https://github.com/python/cpython.git
synced 2025-07-19 17:25:54 +00:00
Fix refleak in compiler.
(A symbol table entry was leaked every time a class was compiled.)
This commit is contained in:
parent
390d29ca74
commit
3a38362592
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||||
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 */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue