File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -608,6 +608,12 @@ def visitModule(self, mod):
608608 PyObject *dict;
609609} AST_object;
610610
611+ static void
612+ ast_dealloc(AST_object *self)
613+ {
614+ Py_CLEAR(self->dict);
615+ }
616+
611617static int
612618ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
613619{
@@ -696,7 +702,7 @@ def visitModule(self, mod):
696702 "_ast.AST",
697703 sizeof(AST_object),
698704 0,
699- 0, /* tp_dealloc */
705+ (destructor)ast_dealloc, /* tp_dealloc */
700706 0, /* tp_print */
701707 0, /* tp_getattr */
702708 0, /* tp_setattr */
Original file line number Diff line number Diff line change @@ -460,6 +460,12 @@ typedef struct {
460460 PyObject * dict ;
461461} AST_object ;
462462
463+ static void
464+ ast_dealloc (AST_object * self )
465+ {
466+ Py_CLEAR (self -> dict );
467+ }
468+
463469static int
464470ast_type_init (PyObject * self , PyObject * args , PyObject * kw )
465471{
@@ -548,7 +554,7 @@ static PyTypeObject AST_type = {
548554 "_ast.AST" ,
549555 sizeof (AST_object ),
550556 0 ,
551- 0 , /* tp_dealloc */
557+ ( destructor ) ast_dealloc , /* tp_dealloc */
552558 0 , /* tp_print */
553559 0 , /* tp_getattr */
554560 0 , /* tp_setattr */
You can’t perform that action at this time.
0 commit comments