@@ -168,13 +168,12 @@ _DictRemover_clear(PyObject *myself)
168168}
169169
170170static void
171- _DictRemover_dealloc (PyObject * myself )
171+ _DictRemover_dealloc (PyObject * self )
172172{
173- PyTypeObject * tp = Py_TYPE (myself );
174- DictRemoverObject * self = _DictRemoverObject_CAST (myself );
175- PyObject_GC_UnTrack (myself );
173+ PyTypeObject * tp = Py_TYPE (self );
174+ PyObject_GC_UnTrack (self );
176175 (void )_DictRemover_clear (self );
177- tp -> tp_free (myself );
176+ tp -> tp_free (self );
178177 Py_DECREF (tp );
179178}
180179
@@ -416,22 +415,21 @@ StructParam_traverse(PyObject *self, visitproc visit, void *arg)
416415}
417416
418417static int
419- StructParam_clear (PyObject * op )
418+ StructParam_clear (PyObject * myself )
420419{
421- StructParamObject * self = _StructParamObject_CAST (op );
420+ StructParamObject * self = _StructParamObject_CAST (myself );
422421 Py_CLEAR (self -> keep );
423422 return 0 ;
424423}
425424
426425static void
427- StructParam_dealloc (PyObject * myself )
426+ StructParam_dealloc (PyObject * self )
428427{
429- StructParamObject * self = _StructParamObject_CAST (myself );
430428 PyTypeObject * tp = Py_TYPE (self );
431- PyObject_GC_UnTrack (myself );
429+ PyObject_GC_UnTrack (self );
432430 (void )StructParam_clear (self );
433- PyMem_Free (self -> ptr );
434- tp -> tp_free (myself );
431+ PyMem_Free (_StructParamObject_CAST ( self ) -> ptr );
432+ tp -> tp_free (self );
435433 Py_DECREF (tp );
436434}
437435
@@ -1417,8 +1415,6 @@ static PyType_Spec pycpointer_type_spec = {
14171415 attribute, and a _type_ attribute.
14181416*/
14191417
1420- #define _CDataObject_CAST (op ) ((CDataObject *)(op))
1421-
14221418static int
14231419CharArray_set_raw (PyObject * op , PyObject * value , void * Py_UNUSED (ignored ))
14241420{
@@ -3262,10 +3258,7 @@ PyObject *
32623258PyCData_get (ctypes_state * st , PyObject * type , GETFUNC getfunc , PyObject * src ,
32633259 Py_ssize_t index , Py_ssize_t size , char * adr )
32643260{
3265- #ifdef Py_GIL_DISABLED
3266- // This isn't used if the GIL is enabled, so it causes a compiler warning.
3267- CDataObject * cdata = (CDataObject * )src ;
3268- #endif
3261+ CDataObject * cdata = _CDataObject_CAST (src );
32693262 if (getfunc ) {
32703263 PyObject * res ;
32713264 LOCK_PTR (cdata );
@@ -3490,8 +3483,6 @@ generic_pycdata_new(ctypes_state *st,
34903483 PyCFuncPtr_Type
34913484*/
34923485
3493- #define _PyCFuncPtrObject_CAST (op ) ((PyCFuncPtrObject *)(op))
3494-
34953486/*[clinic input]
34963487@critical_section
34973488@setter
@@ -4585,7 +4576,7 @@ PyCFuncPtr_clear(PyObject *op)
45854576 Py_CLEAR (self -> converters );
45864577 Py_CLEAR (self -> paramflags );
45874578 Py_CLEAR (self -> thunk );
4588- return PyCData_clear (self );
4579+ return PyCData_clear (op );
45894580}
45904581
45914582static void
@@ -5525,6 +5516,7 @@ Pointer_new(PyTypeObject *type, PyObject *args, PyObject *kw)
55255516static PyObject *
55265517Pointer_subscript (PyObject * myself , PyObject * item )
55275518{
5519+ CDataObject * self = _CDataObject_CAST (myself );
55285520 if (PyIndex_Check (item )) {
55295521 Py_ssize_t i = PyNumber_AsSsize_t (item , PyExc_IndexError );
55305522 if (i == -1 && PyErr_Occurred ())
@@ -5602,7 +5594,7 @@ Pointer_subscript(PyObject *myself, PyObject *item)
56025594 }
56035595 assert (iteminfo );
56045596 if (iteminfo -> getfunc == _ctypes_get_fielddesc ("c" )-> getfunc ) {
5605- char * ptr = locked_deref (_CDataObject_CAST ( myself ) );
5597+ char * ptr = locked_deref (self );
56065598 char * dest ;
56075599
56085600 if (len <= 0 )
@@ -5628,7 +5620,7 @@ Pointer_subscript(PyObject *myself, PyObject *item)
56285620 return np ;
56295621 }
56305622 if (iteminfo -> getfunc == _ctypes_get_fielddesc ("u" )-> getfunc ) {
5631- wchar_t * ptr = locked_deref (_CDataObject_CAST ( myself ) );
5623+ wchar_t * ptr = locked_deref (self );
56325624 wchar_t * dest ;
56335625
56345626 if (len <= 0 )
0 commit comments