free AST's dict

This commit is contained in:
Benjamin Peterson 2012-03-14 21:50:29 -05:00
parent 4775def25d
commit 1767e0274b
2 changed files with 14 additions and 2 deletions

View File

@ -608,6 +608,12 @@ typedef struct {
PyObject *dict; PyObject *dict;
} AST_object; } AST_object;
static void
ast_dealloc(AST_object *self)
{
Py_CLEAR(self->dict);
}
static int static int
ast_type_init(PyObject *self, PyObject *args, PyObject *kw) ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
{ {
@ -696,7 +702,7 @@ static PyTypeObject AST_type = {
"_ast.AST", "_ast.AST",
sizeof(AST_object), sizeof(AST_object),
0, 0,
0, /* tp_dealloc */ (destructor)ast_dealloc, /* tp_dealloc */
0, /* tp_print */ 0, /* tp_print */
0, /* tp_getattr */ 0, /* tp_getattr */
0, /* tp_setattr */ 0, /* tp_setattr */

View File

@ -460,6 +460,12 @@ typedef struct {
PyObject *dict; PyObject *dict;
} AST_object; } AST_object;
static void
ast_dealloc(AST_object *self)
{
Py_CLEAR(self->dict);
}
static int static int
ast_type_init(PyObject *self, PyObject *args, PyObject *kw) ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
{ {
@ -548,7 +554,7 @@ static PyTypeObject AST_type = {
"_ast.AST", "_ast.AST",
sizeof(AST_object), sizeof(AST_object),
0, 0,
0, /* tp_dealloc */ (destructor)ast_dealloc, /* tp_dealloc */
0, /* tp_print */ 0, /* tp_print */
0, /* tp_getattr */ 0, /* tp_getattr */
0, /* tp_setattr */ 0, /* tp_setattr */