@@ -52,6 +52,12 @@ get_testerror(PyObject *self) {
52
52
return state -> error ;
53
53
}
54
54
55
+ static void
56
+ simple_object_dealloc (PyObject * self )
57
+ {
58
+ PyObject_Free (self );
59
+ }
60
+
55
61
/* Raise _testcapi.error with test_name + ": " + msg, and return NULL. */
56
62
57
63
static PyObject *
@@ -171,7 +177,7 @@ static PyTypeObject _HashInheritanceTester_Type = {
171
177
"hashinheritancetester" , /* Name of this type */
172
178
sizeof (PyObject ), /* Basic object size */
173
179
0 , /* Item size for varobject */
174
- ( destructor ) PyObject_Free , /* tp_dealloc */
180
+ simple_object_dealloc , /* tp_dealloc */
175
181
0 , /* tp_vectorcall_offset */
176
182
0 , /* tp_getattr */
177
183
0 , /* tp_setattr */
@@ -1737,7 +1743,7 @@ meth_o(PyObject* self, PyObject* obj)
1737
1743
}
1738
1744
1739
1745
static PyObject *
1740
- meth_noargs (PyObject * self , PyObject * ignored )
1746
+ meth_noargs (PyObject * self , PyObject * Py_UNUSED ( dummy ) )
1741
1747
{
1742
1748
return _null_to_none (self );
1743
1749
}
@@ -2552,10 +2558,10 @@ static PyMethodDef TestMethods[] = {
2552
2558
{"pyobject_repr_from_null" , pyobject_repr_from_null , METH_NOARGS },
2553
2559
{"pyobject_str_from_null" , pyobject_str_from_null , METH_NOARGS },
2554
2560
{"pyobject_bytes_from_null" , pyobject_bytes_from_null , METH_NOARGS },
2555
- {"test_capsule" , ( PyCFunction ) test_capsule , METH_NOARGS },
2556
- {"test_from_contiguous" , ( PyCFunction ) test_from_contiguous , METH_NOARGS },
2561
+ {"test_capsule" , test_capsule , METH_NOARGS },
2562
+ {"test_from_contiguous" , test_from_contiguous , METH_NOARGS },
2557
2563
#if (defined (__linux__ ) || defined (__FreeBSD__ )) && defined (__GNUC__ )
2558
- {"test_pep3118_obsolete_write_locks" , ( PyCFunction ) test_pep3118_obsolete_write_locks , METH_NOARGS },
2564
+ {"test_pep3118_obsolete_write_locks" , test_pep3118_obsolete_write_locks , METH_NOARGS },
2559
2565
#endif
2560
2566
{"getbuffer_with_null_view" , getbuffer_with_null_view , METH_O },
2561
2567
{"PyBuffer_SizeFromFormat" , test_PyBuffer_SizeFromFormat , METH_VARARGS },
@@ -2768,6 +2774,7 @@ typedef struct {
2768
2774
PyObject * ao_iterator ;
2769
2775
} awaitObject ;
2770
2776
2777
+ #define awaitObject_CAST (op ) ((awaitObject *)(op))
2771
2778
2772
2779
static PyObject *
2773
2780
awaitObject_new (PyTypeObject * type , PyObject * args , PyObject * kwds )
@@ -2790,21 +2797,23 @@ awaitObject_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
2790
2797
2791
2798
2792
2799
static void
2793
- awaitObject_dealloc (awaitObject * ao )
2800
+ awaitObject_dealloc (PyObject * op )
2794
2801
{
2802
+ awaitObject * ao = awaitObject_CAST (op );
2795
2803
Py_CLEAR (ao -> ao_iterator );
2796
2804
Py_TYPE (ao )-> tp_free (ao );
2797
2805
}
2798
2806
2799
2807
2800
2808
static PyObject *
2801
- awaitObject_await (awaitObject * ao )
2809
+ awaitObject_await (PyObject * op )
2802
2810
{
2811
+ awaitObject * ao = awaitObject_CAST (op );
2803
2812
return Py_NewRef (ao -> ao_iterator );
2804
2813
}
2805
2814
2806
2815
static PyAsyncMethods awaitType_as_async = {
2807
- ( unaryfunc ) awaitObject_await , /* am_await */
2816
+ awaitObject_await , /* am_await */
2808
2817
0 , /* am_aiter */
2809
2818
0 , /* am_anext */
2810
2819
0 , /* am_send */
@@ -2816,7 +2825,7 @@ static PyTypeObject awaitType = {
2816
2825
"awaitType" ,
2817
2826
sizeof (awaitObject ), /* tp_basicsize */
2818
2827
0 , /* tp_itemsize */
2819
- ( destructor ) awaitObject_dealloc , /* destructor tp_dealloc */
2828
+ awaitObject_dealloc , /* tp_dealloc */
2820
2829
0 , /* tp_vectorcall_offset */
2821
2830
0 , /* tp_getattr */
2822
2831
0 , /* tp_setattr */
@@ -2871,8 +2880,9 @@ MyList_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
2871
2880
}
2872
2881
2873
2882
void
2874
- MyList_dealloc (MyListObject * op )
2883
+ MyList_dealloc (PyObject * self )
2875
2884
{
2885
+ MyListObject * op = (MyListObject * )self ;
2876
2886
if (op -> deallocated ) {
2877
2887
/* We cannot raise exceptions here but we still want the testsuite
2878
2888
* to fail when we hit this */
@@ -2887,7 +2897,7 @@ static PyTypeObject MyList_Type = {
2887
2897
"MyList" ,
2888
2898
sizeof (MyListObject ),
2889
2899
0 ,
2890
- ( destructor ) MyList_dealloc , /* tp_dealloc */
2900
+ MyList_dealloc , /* tp_dealloc */
2891
2901
0 , /* tp_vectorcall_offset */
2892
2902
0 , /* tp_getattr */
2893
2903
0 , /* tp_setattr */
@@ -2935,11 +2945,11 @@ generic_alias_dealloc(PyObject *op)
2935
2945
{
2936
2946
PyGenericAliasObject * self = (PyGenericAliasObject * )op ;
2937
2947
Py_CLEAR (self -> item );
2938
- Py_TYPE (self )-> tp_free (( PyObject * ) self );
2948
+ Py_TYPE (self )-> tp_free (self );
2939
2949
}
2940
2950
2941
2951
static PyObject *
2942
- generic_alias_mro_entries (PyObject * op , PyObject * bases )
2952
+ generic_alias_mro_entries (PyObject * op , PyObject * Py_UNUSED ( bases ) )
2943
2953
{
2944
2954
PyGenericAliasObject * self = (PyGenericAliasObject * )op ;
2945
2955
return PyTuple_Pack (1 , self -> item );
@@ -3090,7 +3100,7 @@ ContainerNoGC_dealloc(PyObject *op)
3090
3100
{
3091
3101
ContainerNoGCobject * self = (ContainerNoGCobject * )op ;
3092
3102
Py_DECREF (self -> value );
3093
- Py_TYPE (self )-> tp_free (( PyObject * ) self );
3103
+ Py_TYPE (self )-> tp_free (self );
3094
3104
}
3095
3105
3096
3106
static PyMemberDef ContainerNoGC_members [] = {
0 commit comments