Commit feb250da authored by Benjamin Peterson's avatar Benjamin Peterson

free AST's dict

parent 28a45ea2
...@@ -608,6 +608,12 @@ typedef struct { ...@@ -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 = { ...@@ -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 */
......
...@@ -460,6 +460,12 @@ typedef struct { ...@@ -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 = { ...@@ -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 */
......
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