Variety of small INC/DECREF patches that fix reported memory leaks

with free variables.  Thanks to Martin v. Loewis for finding two of
the problems.  This fixes SF buf 405583.

There is also a C API change: PyFrame_New() is reverting to its
pre-2.1 signature.  The change introduced by nested scopes was a
mistake.  XXX Is this okay between beta releases?

cell_clear(), the GC helper, must decref its reference to break
cycles.

frame_dealloc() must dealloc all cell vars and free vars in addition
to locals.

eval_code2() setup code must INCREF cells it copies out of the
closure.

The STORE_DEREF opcode implementation must DECREF the object it passes
to PyCell_Set().
This commit is contained in:
Jeremy Hylton 2001-03-13 01:58:22 +00:00
parent 93fe96a3c8
commit 30c9f3991c
5 changed files with 13 additions and 12 deletions

View file

@ -46,8 +46,7 @@ extern DL_IMPORT(PyTypeObject) PyFrame_Type;
#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
DL_IMPORT(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
PyObject *, PyObject *,
PyObject *);
PyObject *, PyObject *);
/* The rest of the interface is specific for frame objects */