@@ -1317,6 +1317,8 @@ map_node_bitmap_dealloc(MapNode_Bitmap *self)
13171317{
13181318 /* Bitmap's tp_dealloc */
13191319
1320+ PyTypeObject * tp = Py_TYPE (self );
1321+
13201322 Py_ssize_t len = Py_SIZE (self );
13211323 Py_ssize_t i ;
13221324
@@ -1330,8 +1332,10 @@ map_node_bitmap_dealloc(MapNode_Bitmap *self)
13301332 }
13311333 }
13321334
1333- Py_TYPE ( self ) -> tp_free (( PyObject * ) self );
1335+ PyObject_GC_Del ( self );
13341336 Py_TRASHCAN_END
1337+
1338+ Py_DECREF (tp );
13351339}
13361340
13371341static int
@@ -1747,6 +1751,8 @@ map_node_collision_dealloc(MapNode_Collision *self)
17471751{
17481752 /* Collision's tp_dealloc */
17491753
1754+ PyTypeObject * tp = Py_TYPE (self );
1755+
17501756 Py_ssize_t len = Py_SIZE (self );
17511757
17521758 PyObject_GC_UnTrack (self );
@@ -1759,8 +1765,10 @@ map_node_collision_dealloc(MapNode_Collision *self)
17591765 }
17601766 }
17611767
1762- Py_TYPE ( self ) -> tp_free (( PyObject * ) self );
1768+ PyObject_GC_Del ( self );
17631769 Py_TRASHCAN_END
1770+
1771+ Py_DECREF (tp );
17641772}
17651773
17661774static int
@@ -2174,6 +2182,8 @@ map_node_array_dealloc(MapNode_Array *self)
21742182{
21752183 /* Array's tp_dealloc */
21762184
2185+ PyTypeObject * tp = Py_TYPE (self );
2186+
21772187 Py_ssize_t i ;
21782188
21792189 PyObject_GC_UnTrack (self );
@@ -2183,8 +2193,10 @@ map_node_array_dealloc(MapNode_Array *self)
21832193 Py_XDECREF (self -> a_array [i ]);
21842194 }
21852195
2186- Py_TYPE ( self ) -> tp_free (( PyObject * ) self );
2196+ PyObject_GC_Del ( self );
21872197 Py_TRASHCAN_END
2198+
2199+ Py_DECREF (tp );
21882200}
21892201
21902202static int
@@ -2764,9 +2776,11 @@ map_baseiter_tp_clear(MapIterator *it)
27642776static void
27652777map_baseiter_tp_dealloc (MapIterator * it )
27662778{
2779+ PyTypeObject * tp = Py_TYPE (it );
27672780 PyObject_GC_UnTrack (it );
27682781 (void )map_baseiter_tp_clear (it );
27692782 PyObject_GC_Del (it );
2783+ Py_DECREF (tp );
27702784}
27712785
27722786static int
@@ -2811,9 +2825,11 @@ map_baseview_tp_clear(MapView *view)
28112825static void
28122826map_baseview_tp_dealloc (MapView * view )
28132827{
2828+ PyTypeObject * tp = Py_TYPE (view );
28142829 PyObject_GC_UnTrack (view );
28152830 (void )map_baseview_tp_clear (view );
28162831 PyObject_GC_Del (view );
2832+ Py_DECREF (tp );
28172833}
28182834
28192835static int
@@ -3139,10 +3155,12 @@ map_tp_traverse(BaseMapObject *self, visitproc visit, void *arg)
31393155static void
31403156map_tp_dealloc (BaseMapObject * self )
31413157{
3158+ PyTypeObject * tp = Py_TYPE (self );
31423159 PyObject_GC_UnTrack (self );
31433160 PyObject_ClearWeakRefs ((PyObject * )self );
31443161 (void )map_tp_clear (self );
3145- Py_TYPE (self )-> tp_free (self );
3162+ PyObject_GC_Del (self );
3163+ Py_DECREF (tp );
31463164}
31473165
31483166
0 commit comments