@@ -129,6 +129,9 @@ typedef struct {
129
129
PyThread_type_lock lock ;
130
130
} BZ2Decompressor ;
131
131
132
+ #define _BZ2Compressor_CAST (op ) ((BZ2Compressor *)(op))
133
+ #define _BZ2Decompressor_CAST (op ) ((BZ2Decompressor *)(op))
134
+
132
135
/* Helper functions. */
133
136
134
137
static int
@@ -376,8 +379,9 @@ _bz2_BZ2Compressor_impl(PyTypeObject *type, int compresslevel)
376
379
}
377
380
378
381
static void
379
- BZ2Compressor_dealloc (BZ2Compressor * self )
382
+ BZ2Compressor_dealloc (PyObject * op )
380
383
{
384
+ BZ2Compressor * self = _BZ2Compressor_CAST (op );
381
385
BZ2_bzCompressEnd (& self -> bzs );
382
386
if (self -> lock != NULL ) {
383
387
PyThread_free_lock (self -> lock );
@@ -388,7 +392,7 @@ BZ2Compressor_dealloc(BZ2Compressor *self)
388
392
}
389
393
390
394
static int
391
- BZ2Compressor_traverse (BZ2Compressor * self , visitproc visit , void * arg )
395
+ BZ2Compressor_traverse (PyObject * self , visitproc visit , void * arg )
392
396
{
393
397
Py_VISIT (Py_TYPE (self ));
394
398
return 0 ;
@@ -680,8 +684,10 @@ _bz2_BZ2Decompressor_impl(PyTypeObject *type)
680
684
}
681
685
682
686
static void
683
- BZ2Decompressor_dealloc (BZ2Decompressor * self )
687
+ BZ2Decompressor_dealloc (PyObject * op )
684
688
{
689
+ BZ2Decompressor * self = _BZ2Decompressor_CAST (op );
690
+
685
691
if (self -> input_buffer != NULL ) {
686
692
PyMem_Free (self -> input_buffer );
687
693
}
@@ -697,7 +703,7 @@ BZ2Decompressor_dealloc(BZ2Decompressor *self)
697
703
}
698
704
699
705
static int
700
- BZ2Decompressor_traverse (BZ2Decompressor * self , visitproc visit , void * arg )
706
+ BZ2Decompressor_traverse (PyObject * self , visitproc visit , void * arg )
701
707
{
702
708
Py_VISIT (Py_TYPE (self ));
703
709
return 0 ;
0 commit comments