@@ -129,6 +129,9 @@ typedef struct {
129129 PyThread_type_lock lock ;
130130} BZ2Decompressor ;
131131
132+ #define _BZ2Compressor_CAST (op ) ((BZ2Compressor *)(op))
133+ #define _BZ2Decompressor_CAST (op ) ((BZ2Decompressor *)(op))
134+
132135/* Helper functions. */
133136
134137static int
@@ -376,8 +379,9 @@ _bz2_BZ2Compressor_impl(PyTypeObject *type, int compresslevel)
376379}
377380
378381static void
379- BZ2Compressor_dealloc (BZ2Compressor * self )
382+ BZ2Compressor_dealloc (PyObject * op )
380383{
384+ BZ2Compressor * self = _BZ2Compressor_CAST (op );
381385 BZ2_bzCompressEnd (& self -> bzs );
382386 if (self -> lock != NULL ) {
383387 PyThread_free_lock (self -> lock );
@@ -388,7 +392,7 @@ BZ2Compressor_dealloc(BZ2Compressor *self)
388392}
389393
390394static int
391- BZ2Compressor_traverse (BZ2Compressor * self , visitproc visit , void * arg )
395+ BZ2Compressor_traverse (PyObject * self , visitproc visit , void * arg )
392396{
393397 Py_VISIT (Py_TYPE (self ));
394398 return 0 ;
@@ -680,8 +684,10 @@ _bz2_BZ2Decompressor_impl(PyTypeObject *type)
680684}
681685
682686static void
683- BZ2Decompressor_dealloc (BZ2Decompressor * self )
687+ BZ2Decompressor_dealloc (PyObject * op )
684688{
689+ BZ2Decompressor * self = _BZ2Decompressor_CAST (op );
690+
685691 if (self -> input_buffer != NULL ) {
686692 PyMem_Free (self -> input_buffer );
687693 }
@@ -697,7 +703,7 @@ BZ2Decompressor_dealloc(BZ2Decompressor *self)
697703}
698704
699705static int
700- BZ2Decompressor_traverse (BZ2Decompressor * self , visitproc visit , void * arg )
706+ BZ2Decompressor_traverse (PyObject * self , visitproc visit , void * arg )
701707{
702708 Py_VISIT (Py_TYPE (self ));
703709 return 0 ;
0 commit comments