https://github.com/python/cpython/commit/34c1ea3109d750896bc27b575ebaec85a371d0ba
commit: 34c1ea3109d750896bc27b575ebaec85a371d0ba
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-03-20T12:27:03+01:00
summary:

gh-111178: Fix function signatures for multiple tests (#131496)

files:
M Modules/_decimal/_decimal.c
M Modules/_ssl.c
M Modules/_testbuffer.c
M Modules/_testcapimodule.c
M Modules/_testlimitedcapi/vectorcall_limited.c
M Modules/xxlimited_35.c
M Modules/zlibmodule.c
M Objects/genobject.c
M Objects/longobject.c
M Objects/picklebufobject.c
M Objects/setobject.c
M Objects/sliceobject.c
M Objects/stringlib/unicode_format.h
M Python/hamt.c
M Python/tracemalloc.c

diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 8a24d8c12cab8a..c7a0eed1118434 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -4995,8 +4995,9 @@ _dec_hash(PyDecObject *v)
 }
 
 static Py_hash_t
-dec_hash(PyDecObject *self)
+dec_hash(PyObject *op)
 {
+    PyDecObject *self = _PyDecObject_CAST(op);
     if (self->hash == -1) {
         self->hash = _dec_hash(self);
     }
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index af67e980dd7933..071524fa9d4195 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -451,8 +451,9 @@ PyDoc_STRVAR(SSLEOFError_doc,
 "SSL/TLS connection terminated abruptly.");
 
 static PyObject *
-SSLError_str(PyOSErrorObject *self)
+SSLError_str(PyObject *op)
 {
+    PyOSErrorObject *self = (PyOSErrorObject*)op;
     if (self->strerror != NULL && PyUnicode_Check(self->strerror)) {
         return Py_NewRef(self->strerror);
     }
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index e0521827f414f2..7ecb11da2bb6af 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -1778,8 +1778,9 @@ copy_structure(Py_buffer *base)
 }
 
 static PyObject *
-ndarray_subscript(NDArrayObject *self, PyObject *key)
+ndarray_subscript(PyObject *op, PyObject *key)
 {
+    NDArrayObject *self = (NDArrayObject*)op;
     NDArrayObject *nd;
     ndbuf_t *ndbuf;
     Py_buffer *base = &self->head->base;
@@ -1862,8 +1863,9 @@ ndarray_subscript(NDArrayObject *self, PyObject *key)
 
 
 static int
-ndarray_ass_subscript(NDArrayObject *self, PyObject *key, PyObject *value)
+ndarray_ass_subscript(PyObject *op, PyObject *key, PyObject *value)
 {
+    NDArrayObject *self = (NDArrayObject*)op;
     NDArrayObject *nd;
     Py_buffer *dest = &self->head->base;
     Py_buffer src;
@@ -1907,7 +1909,7 @@ ndarray_ass_subscript(NDArrayObject *self, PyObject *key, 
PyObject *value)
     if (PyObject_GetBuffer(value, &src, PyBUF_FULL_RO) == -1)
         return -1;
 
-    nd = (NDArrayObject *)ndarray_subscript(self, key);
+    nd = (NDArrayObject *)ndarray_subscript((PyObject*)self, key);
     if (nd != NULL) {
         dest = &nd->head->base;
         ret = copy_buffer(dest, &src);
@@ -1959,8 +1961,8 @@ slice_indices(PyObject *self, PyObject *args)
 
 static PyMappingMethods ndarray_as_mapping = {
     NULL,                                 /* mp_length */
-    (binaryfunc)ndarray_subscript,        /* mp_subscript */
-    (objobjargproc)ndarray_ass_subscript  /* mp_ass_subscript */
+    ndarray_subscript,                    /* mp_subscript */
+    ndarray_ass_subscript                 /* mp_ass_subscript */
 };
 
 static PySequenceMethods ndarray_as_sequence = {
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 409dd02e1435b5..caaf83f578fc0f 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2931,20 +2931,22 @@ typedef struct {
 } PyGenericAliasObject;
 
 static void
-generic_alias_dealloc(PyGenericAliasObject *self)
+generic_alias_dealloc(PyObject *op)
 {
+    PyGenericAliasObject *self = (PyGenericAliasObject*)op;
     Py_CLEAR(self->item);
     Py_TYPE(self)->tp_free((PyObject *)self);
 }
 
 static PyObject *
-generic_alias_mro_entries(PyGenericAliasObject *self, PyObject *bases)
+generic_alias_mro_entries(PyObject *op, PyObject *bases)
 {
+    PyGenericAliasObject *self = (PyGenericAliasObject*)op;
     return PyTuple_Pack(1, self->item);
 }
 
 static PyMethodDef generic_alias_methods[] = {
-    {"__mro_entries__", _PyCFunction_CAST(generic_alias_mro_entries), METH_O, 
NULL},
+    {"__mro_entries__", generic_alias_mro_entries, METH_O, NULL},
     {NULL}  /* sentinel */
 };
 
@@ -2953,7 +2955,7 @@ static PyTypeObject GenericAlias_Type = {
     "GenericAlias",
     sizeof(PyGenericAliasObject),
     0,
-    .tp_dealloc = (destructor)generic_alias_dealloc,
+    .tp_dealloc = generic_alias_dealloc,
     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     .tp_methods = generic_alias_methods,
 };
@@ -3084,8 +3086,9 @@ ContainerNoGC_new(PyTypeObject *type, PyObject *args, 
PyObject *kwargs)
 }
 
 static void
-ContainerNoGC_dealloc(ContainerNoGCobject *self)
+ContainerNoGC_dealloc(PyObject *op)
 {
+    ContainerNoGCobject *self = (ContainerNoGCobject*)op;
     Py_DECREF(self->value);
     Py_TYPE(self)->tp_free((PyObject *)self);
 }
@@ -3100,7 +3103,7 @@ static PyTypeObject ContainerNoGC_type = {
     PyVarObject_HEAD_INIT(NULL, 0)
     "_testcapi.ContainerNoGC",
     sizeof(ContainerNoGCobject),
-    .tp_dealloc = (destructor)ContainerNoGC_dealloc,
+    .tp_dealloc = ContainerNoGC_dealloc,
     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     .tp_members = ContainerNoGC_members,
     .tp_new = ContainerNoGC_new,
diff --git a/Modules/_testlimitedcapi/vectorcall_limited.c 
b/Modules/_testlimitedcapi/vectorcall_limited.c
index 4a7af965776470..84362d523f4963 100644
--- a/Modules/_testlimitedcapi/vectorcall_limited.c
+++ b/Modules/_testlimitedcapi/vectorcall_limited.c
@@ -30,7 +30,7 @@ LimitedVectorCallClass_vectorcall(PyObject *callable,
 }
 
 static PyObject *
-LimitedVectorCallClass_new(PyTypeObject *tp, PyTypeObject *a, PyTypeObject *kw)
+LimitedVectorCallClass_new(PyTypeObject *tp, PyObject *a, PyObject *kw)
 {
     PyObject *self = ((allocfunc)PyType_GetSlot(tp, Py_tp_alloc))(tp, 0);
     if (!self) {
@@ -182,7 +182,7 @@ typedef struct {
 } LimitedRelativeVectorCallStruct;
 
 static PyObject *
-LimitedRelativeVectorCallClass_new(PyTypeObject *tp, PyTypeObject *a, 
PyTypeObject *kw)
+LimitedRelativeVectorCallClass_new(PyTypeObject *tp, PyObject *a, PyObject *kw)
 {
     PyObject *self = ((allocfunc)PyType_GetSlot(tp, Py_tp_alloc))(tp, 0);
     if (!self) {
diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c
index 48fd1aac3f0f8d..b0a682ac4e6bb6 100644
--- a/Modules/xxlimited_35.c
+++ b/Modules/xxlimited_35.c
@@ -100,7 +100,7 @@ Xxo_getattro(PyObject *op, PyObject *name)
 }
 
 static int
-Xxo_setattr(PyObject *op, const char *name, PyObject *v)
+Xxo_setattr(PyObject *op, char *name, PyObject *v)
 {
     XxoObject *self = XxoObject_CAST(op);
     if (self->x_attr == NULL) {
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 94575025b16941..d4b4b91697c08e 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -1363,8 +1363,9 @@ class zlib.ZlibDecompressor "ZlibDecompressor *" 
"&ZlibDecompressorType"
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=0658178ab94645df]*/
 
 static void
-ZlibDecompressor_dealloc(ZlibDecompressor *self)
+ZlibDecompressor_dealloc(PyObject *op)
 {
+    ZlibDecompressor *self = (ZlibDecompressor*)op;
     PyObject *type = (PyObject *)Py_TYPE(self);
     PyThread_free_lock(self->lock);
     if (self->is_initialised) {
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 0669dba1f36c1b..308d45701d296f 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1534,8 +1534,9 @@ async_gen_anext(PyObject *self)
 
 
 static PyObject *
-async_gen_asend(PyAsyncGenObject *o, PyObject *arg)
+async_gen_asend(PyObject *op, PyObject *arg)
 {
+    PyAsyncGenObject *o = (PyAsyncGenObject*)op;
     if (async_gen_init_hooks(o)) {
         return NULL;
     }
@@ -1544,8 +1545,9 @@ async_gen_asend(PyAsyncGenObject *o, PyObject *arg)
 
 
 static PyObject *
-async_gen_aclose(PyAsyncGenObject *o, PyObject *arg)
+async_gen_aclose(PyObject *op, PyObject *arg)
 {
+    PyAsyncGenObject *o = (PyAsyncGenObject*)op;
     if (async_gen_init_hooks(o)) {
         return NULL;
     }
@@ -1553,8 +1555,9 @@ async_gen_aclose(PyAsyncGenObject *o, PyObject *arg)
 }
 
 static PyObject *
-async_gen_athrow(PyAsyncGenObject *o, PyObject *args)
+async_gen_athrow(PyObject *op, PyObject *args)
 {
+    PyAsyncGenObject *o = (PyAsyncGenObject*)op;
     if (PyTuple_GET_SIZE(args) > 1) {
         if (PyErr_WarnEx(PyExc_DeprecationWarning,
                             "the (type, exc, tb) signature of athrow() is 
deprecated, "
@@ -1625,9 +1628,9 @@ the (type, val, tb) signature is deprecated, \n\
 and may be removed in a future version of Python.");
 
 static PyMethodDef async_gen_methods[] = {
-    {"asend", (PyCFunction)async_gen_asend, METH_O, async_asend_doc},
-    {"athrow",(PyCFunction)async_gen_athrow, METH_VARARGS, async_athrow_doc},
-    {"aclose", (PyCFunction)async_gen_aclose, METH_NOARGS, async_aclose_doc},
+    {"asend", async_gen_asend, METH_O, async_asend_doc},
+    {"athrow", async_gen_athrow, METH_VARARGS, async_athrow_doc},
+    {"aclose", async_gen_aclose, METH_NOARGS, async_aclose_doc},
     {"__sizeof__", gen_sizeof, METH_NOARGS, sizeof__doc__},
     {"__class_getitem__",    Py_GenericAlias,
     METH_O|METH_CLASS,       PyDoc_STR("See PEP 585")},
@@ -2324,8 +2327,9 @@ async_gen_athrow_close(PyObject *self, PyObject *args)
 
 
 static void
-async_gen_athrow_finalize(PyAsyncGenAThrow *o)
+async_gen_athrow_finalize(PyObject *op)
 {
+    PyAsyncGenAThrow *o = (PyAsyncGenAThrow*)op;
     if (o->agt_state == AWAITABLE_STATE_INIT) {
         PyObject *method = o->agt_args ? &_Py_ID(athrow) : &_Py_ID(aclose);
         _PyErr_WarnUnawaitedAgenMethod(o->agt_gen, method);
@@ -2389,7 +2393,7 @@ PyTypeObject _PyAsyncGenAThrow_Type = {
     0,                                          /* tp_init */
     0,                                          /* tp_alloc */
     0,                                          /* tp_new */
-    .tp_finalize = (destructor)async_gen_athrow_finalize,
+    .tp_finalize = async_gen_athrow_finalize,
 };
 
 
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 9498c06c4208e7..984381ff4969d0 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -6474,6 +6474,12 @@ long_long_meth(PyObject *self, PyObject 
*Py_UNUSED(ignored))
     return long_long(self);
 }
 
+static PyObject *
+long_long_getter(PyObject *self, void *Py_UNUSED(ignored))
+{
+    return long_long(self);
+}
+
 /*[clinic input]
 int.is_integer
 
@@ -6534,7 +6540,7 @@ static PyMethodDef long_methods[] = {
 
 static PyGetSetDef long_getset[] = {
     {"real",
-     (getter)long_long_meth, (setter)NULL,
+     long_long_getter, (setter)NULL,
      "the real part of a complex number",
      NULL},
     {"imag",
@@ -6542,7 +6548,7 @@ static PyGetSetDef long_getset[] = {
      "the imaginary part of a complex number",
      NULL},
     {"numerator",
-     (getter)long_long_meth, (setter)NULL,
+     long_long_getter, (setter)NULL,
      "the numerator of a rational number in lowest terms",
      NULL},
     {"denominator",
diff --git a/Objects/picklebufobject.c b/Objects/picklebufobject.c
index ca83a0a0806ce1..3ce800de04c208 100644
--- a/Objects/picklebufobject.c
+++ b/Objects/picklebufobject.c
@@ -91,22 +91,25 @@ picklebuf_new(PyTypeObject *type, PyObject *args, PyObject 
*kwds)
 }
 
 static int
-picklebuf_traverse(PyPickleBufferObject *self, visitproc visit, void *arg)
+picklebuf_traverse(PyObject *op, visitproc visit, void *arg)
 {
+    PyPickleBufferObject *self = (PyPickleBufferObject*)op;
     Py_VISIT(self->view.obj);
     return 0;
 }
 
 static int
-picklebuf_clear(PyPickleBufferObject *self)
+picklebuf_clear(PyObject *op)
 {
+    PyPickleBufferObject *self = (PyPickleBufferObject*)op;
     PyBuffer_Release(&self->view);
     return 0;
 }
 
 static void
-picklebuf_dealloc(PyPickleBufferObject *self)
+picklebuf_dealloc(PyObject *op)
 {
+    PyPickleBufferObject *self = (PyPickleBufferObject*)op;
     PyObject_GC_UnTrack(self);
     if (self->weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject *) self);
@@ -117,8 +120,9 @@ picklebuf_dealloc(PyPickleBufferObject *self)
 /* Buffer API */
 
 static int
-picklebuf_getbuf(PyPickleBufferObject *self, Py_buffer *view, int flags)
+picklebuf_getbuf(PyObject *op, Py_buffer *view, int flags)
 {
+    PyPickleBufferObject *self = (PyPickleBufferObject*)op;
     if (self->view.obj == NULL) {
         PyErr_SetString(PyExc_ValueError,
                         "operation forbidden on released PickleBuffer object");
@@ -128,7 +132,7 @@ picklebuf_getbuf(PyPickleBufferObject *self, Py_buffer 
*view, int flags)
 }
 
 static void
-picklebuf_releasebuf(PyPickleBufferObject *self, Py_buffer *view)
+picklebuf_releasebuf(PyObject *self, Py_buffer *view)
 {
     /* Since our bf_getbuffer redirects to the original object, this
      * implementation is never called.  It only exists to signal that
@@ -138,15 +142,16 @@ picklebuf_releasebuf(PyPickleBufferObject *self, 
Py_buffer *view)
 }
 
 static PyBufferProcs picklebuf_as_buffer = {
-    .bf_getbuffer = (getbufferproc) picklebuf_getbuf,
-    .bf_releasebuffer = (releasebufferproc) picklebuf_releasebuf,
+    .bf_getbuffer = picklebuf_getbuf,
+    .bf_releasebuffer = picklebuf_releasebuf,
 };
 
 /* Methods */
 
 static PyObject *
-picklebuf_raw(PyPickleBufferObject *self, PyObject *Py_UNUSED(ignored))
+picklebuf_raw(PyObject *op, PyObject *Py_UNUSED(ignored))
 {
+    PyPickleBufferObject *self = (PyPickleBufferObject*)op;
     if (self->view.obj == NULL) {
         PyErr_SetString(PyExc_ValueError,
                         "operation forbidden on released PickleBuffer object");
@@ -185,8 +190,9 @@ Return a memoryview of the raw memory underlying this 
buffer.\n\
 Will raise BufferError is the buffer isn't contiguous.");
 
 static PyObject *
-picklebuf_release(PyPickleBufferObject *self, PyObject *Py_UNUSED(ignored))
+picklebuf_release(PyObject *op, PyObject *Py_UNUSED(ignored))
 {
+    PyPickleBufferObject *self = (PyPickleBufferObject*)op;
     PyBuffer_Release(&self->view);
     Py_RETURN_NONE;
 }
@@ -197,8 +203,8 @@ PyDoc_STRVAR(picklebuf_release_doc,
 Release the underlying buffer exposed by the PickleBuffer object.");
 
 static PyMethodDef picklebuf_methods[] = {
-    {"raw",     (PyCFunction) picklebuf_raw,     METH_NOARGS, 
picklebuf_raw_doc},
-    {"release", (PyCFunction) picklebuf_release, METH_NOARGS, 
picklebuf_release_doc},
+    {"raw",     picklebuf_raw,     METH_NOARGS, picklebuf_raw_doc},
+    {"release", picklebuf_release, METH_NOARGS, picklebuf_release_doc},
     {NULL,      NULL}
 };
 
@@ -209,9 +215,9 @@ PyTypeObject PyPickleBuffer_Type = {
     .tp_basicsize = sizeof(PyPickleBufferObject),
     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
     .tp_new = picklebuf_new,
-    .tp_dealloc = (destructor) picklebuf_dealloc,
-    .tp_traverse = (traverseproc) picklebuf_traverse,
-    .tp_clear = (inquiry) picklebuf_clear,
+    .tp_dealloc = picklebuf_dealloc,
+    .tp_traverse = picklebuf_traverse,
+    .tp_clear = picklebuf_clear,
     .tp_weaklistoffset = offsetof(PyPickleBufferObject, weakreflist),
     .tp_as_buffer = &picklebuf_as_buffer,
     .tp_methods = picklebuf_methods,
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 27b370e8e4fb05..9181bc27ac4e97 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -816,8 +816,9 @@ setiter_traverse(PyObject *self, visitproc visit, void *arg)
 }
 
 static PyObject *
-setiter_len(setiterobject *si, PyObject *Py_UNUSED(ignored))
+setiter_len(PyObject *op, PyObject *Py_UNUSED(ignored))
 {
+    setiterobject *si = (setiterobject*)op;
     Py_ssize_t len = 0;
     if (si->si_set != NULL && si->si_used == si->si_set->used)
         len = si->len;
@@ -827,8 +828,10 @@ setiter_len(setiterobject *si, PyObject 
*Py_UNUSED(ignored))
 PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of 
len(list(it)).");
 
 static PyObject *
-setiter_reduce(setiterobject *si, PyObject *Py_UNUSED(ignored))
+setiter_reduce(PyObject *op, PyObject *Py_UNUSED(ignored))
 {
+    setiterobject *si = (setiterobject*)op;
+
     /* copy the iterator state */
     setiterobject tmp = *si;
     Py_XINCREF(tmp.si_set);
@@ -845,8 +848,8 @@ setiter_reduce(setiterobject *si, PyObject 
*Py_UNUSED(ignored))
 PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
 
 static PyMethodDef setiter_methods[] = {
-    {"__length_hint__", (PyCFunction)setiter_len, METH_NOARGS, 
length_hint_doc},
-    {"__reduce__", (PyCFunction)setiter_reduce, METH_NOARGS, reduce_doc},
+    {"__length_hint__", setiter_len, METH_NOARGS, length_hint_doc},
+    {"__reduce__", setiter_reduce, METH_NOARGS, reduce_doc},
     {NULL,              NULL}           /* sentinel */
 };
 
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 9f6d51cb79c73b..5186ff4f6f0cf5 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -522,8 +522,9 @@ _PySlice_GetLongIndices(PySliceObject *self, PyObject 
*length,
 /* Implementation of slice.indices. */
 
 static PyObject*
-slice_indices(PySliceObject* self, PyObject* len)
+slice_indices(PyObject *op, PyObject* len)
 {
+    PySliceObject *self = _PySlice_CAST(op);
     PyObject *start, *stop, *step;
     PyObject *length;
     int error;
@@ -557,18 +558,17 @@ S. Out of bounds indices are clipped in a manner 
consistent with the\n\
 handling of normal slices.");
 
 static PyObject *
-slice_reduce(PySliceObject* self, PyObject *Py_UNUSED(ignored))
+slice_reduce(PyObject *op, PyObject *Py_UNUSED(ignored))
 {
+    PySliceObject *self = _PySlice_CAST(op);
     return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, 
self->step);
 }
 
 PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
 
 static PyMethodDef slice_methods[] = {
-    {"indices",         (PyCFunction)slice_indices,
-     METH_O,            slice_indices_doc},
-    {"__reduce__",      (PyCFunction)slice_reduce,
-     METH_NOARGS,       reduce_doc},
+    {"indices", slice_indices, METH_O, slice_indices_doc},
+    {"__reduce__", slice_reduce, METH_NOARGS, reduce_doc},
     {NULL, NULL}
 };
 
diff --git a/Objects/stringlib/unicode_format.h 
b/Objects/stringlib/unicode_format.h
index 44b269ba8ceb55..982fc5184a5b2a 100644
--- a/Objects/stringlib/unicode_format.h
+++ b/Objects/stringlib/unicode_format.h
@@ -977,8 +977,9 @@ typedef struct {
 } formatteriterobject;
 
 static void
-formatteriter_dealloc(formatteriterobject *it)
+formatteriter_dealloc(PyObject *op)
 {
+    formatteriterobject *it = (formatteriterobject*)op;
     Py_XDECREF(it->str);
     PyObject_Free(it);
 }
@@ -992,8 +993,9 @@ formatteriter_dealloc(formatteriterobject *it)
    conversion is either None, or the string after the '!'
 */
 static PyObject *
-formatteriter_next(formatteriterobject *it)
+formatteriter_next(PyObject *op)
 {
+    formatteriterobject *it = (formatteriterobject*)op;
     SubString literal;
     SubString field_name;
     SubString format_spec;
@@ -1066,7 +1068,7 @@ static PyTypeObject PyFormatterIter_Type = {
     sizeof(formatteriterobject),        /* tp_basicsize */
     0,                                  /* tp_itemsize */
     /* methods */
-    (destructor)formatteriter_dealloc,  /* tp_dealloc */
+    formatteriter_dealloc,              /* tp_dealloc */
     0,                                  /* tp_vectorcall_offset */
     0,                                  /* tp_getattr */
     0,                                  /* tp_setattr */
@@ -1088,7 +1090,7 @@ static PyTypeObject PyFormatterIter_Type = {
     0,                                  /* tp_richcompare */
     0,                                  /* tp_weaklistoffset */
     PyObject_SelfIter,                  /* tp_iter */
-    (iternextfunc)formatteriter_next,   /* tp_iternext */
+    formatteriter_next,                 /* tp_iternext */
     formatteriter_methods,              /* tp_methods */
     0,
 };
@@ -1136,8 +1138,9 @@ typedef struct {
 } fieldnameiterobject;
 
 static void
-fieldnameiter_dealloc(fieldnameiterobject *it)
+fieldnameiter_dealloc(PyObject *op)
 {
+    fieldnameiterobject *it = (fieldnameiterobject*)op;
     Py_XDECREF(it->str);
     PyObject_Free(it);
 }
@@ -1149,8 +1152,9 @@ fieldnameiter_dealloc(fieldnameiterobject *it)
    value is an integer or string
 */
 static PyObject *
-fieldnameiter_next(fieldnameiterobject *it)
+fieldnameiter_next(PyObject *op)
 {
+    fieldnameiterobject *it = (fieldnameiterobject*)op;
     int result;
     int is_attr;
     Py_ssize_t idx;
@@ -1198,7 +1202,7 @@ static PyTypeObject PyFieldNameIter_Type = {
     sizeof(fieldnameiterobject),        /* tp_basicsize */
     0,                                  /* tp_itemsize */
     /* methods */
-    (destructor)fieldnameiter_dealloc,  /* tp_dealloc */
+    fieldnameiter_dealloc,              /* tp_dealloc */
     0,                                  /* tp_vectorcall_offset */
     0,                                  /* tp_getattr */
     0,                                  /* tp_setattr */
@@ -1220,7 +1224,7 @@ static PyTypeObject PyFieldNameIter_Type = {
     0,                                  /* tp_richcompare */
     0,                                  /* tp_weaklistoffset */
     PyObject_SelfIter,                  /* tp_iter */
-    (iternextfunc)fieldnameiter_next,   /* tp_iternext */
+    fieldnameiter_next,                 /* tp_iternext */
     fieldnameiter_methods,              /* tp_methods */
     0};
 
diff --git a/Python/hamt.c b/Python/hamt.c
index ed43a0449d7a01..42a0baffd9def9 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -2433,14 +2433,15 @@ hamt_dump(PyHamtObject *self)
 
 
 static int
-hamt_baseiter_tp_clear(PyHamtIterator *it)
+hamt_baseiter_tp_clear(PyObject *op)
 {
+    PyHamtIterator *it = (PyHamtIterator*)op;
     Py_CLEAR(it->hi_obj);
     return 0;
 }
 
 static void
-hamt_baseiter_tp_dealloc(PyHamtIterator *it)
+hamt_baseiter_tp_dealloc(PyObject *it)
 {
     PyObject_GC_UnTrack(it);
     (void)hamt_baseiter_tp_clear(it);
@@ -2448,15 +2449,17 @@ hamt_baseiter_tp_dealloc(PyHamtIterator *it)
 }
 
 static int
-hamt_baseiter_tp_traverse(PyHamtIterator *it, visitproc visit, void *arg)
+hamt_baseiter_tp_traverse(PyObject *op, visitproc visit, void *arg)
 {
+    PyHamtIterator *it = (PyHamtIterator*)op;
     Py_VISIT(it->hi_obj);
     return 0;
 }
 
 static PyObject *
-hamt_baseiter_tp_iternext(PyHamtIterator *it)
+hamt_baseiter_tp_iternext(PyObject *op)
 {
+    PyHamtIterator *it = (PyHamtIterator*)op;
     PyObject *key;
     PyObject *val;
     hamt_iter_t res = hamt_iterator_next(&it->hi_iter, &key, &val);
@@ -2477,13 +2480,14 @@ hamt_baseiter_tp_iternext(PyHamtIterator *it)
 }
 
 static Py_ssize_t
-hamt_baseiter_tp_len(PyHamtIterator *it)
+hamt_baseiter_tp_len(PyObject *op)
 {
+    PyHamtIterator *it = (PyHamtIterator*)op;
     return it->hi_obj->h_count;
 }
 
 static PyMappingMethods PyHamtIterator_as_mapping = {
-    (lenfunc)hamt_baseiter_tp_len,
+    hamt_baseiter_tp_len,
 };
 
 static PyObject *
@@ -2506,11 +2510,11 @@ hamt_baseiter_new(PyTypeObject *type, binaryfunc yield, 
PyHamtObject *o)
     .tp_basicsize = sizeof(PyHamtIterator),                     \
     .tp_itemsize = 0,                                           \
     .tp_as_mapping = &PyHamtIterator_as_mapping,                \
-    .tp_dealloc = (destructor)hamt_baseiter_tp_dealloc,         \
+    .tp_dealloc = hamt_baseiter_tp_dealloc,                     \
     .tp_getattro = PyObject_GenericGetAttr,                     \
     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,        \
-    .tp_traverse = (traverseproc)hamt_baseiter_tp_traverse,     \
-    .tp_clear = (inquiry)hamt_baseiter_tp_clear,                \
+    .tp_traverse = hamt_baseiter_tp_traverse,                   \
+    .tp_clear = hamt_baseiter_tp_clear,                         \
     .tp_iter = PyObject_SelfIter,                               \
     .tp_iternext = (iternextfunc)hamt_baseiter_tp_iternext,
 
diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c
index 82e9c6f95e9cf4..2bdb6c36bdb18d 100644
--- a/Python/tracemalloc.c
+++ b/Python/tracemalloc.c
@@ -378,13 +378,21 @@ tracemalloc_create_traces_table(void)
 }
 
 
+static void
+tracemalloc_destroy_domain(void *value)
+{
+    _Py_hashtable_t *ht = (_Py_hashtable_t*)value;
+    _Py_hashtable_destroy(ht);
+}
+
+
 static _Py_hashtable_t*
 tracemalloc_create_domains_table(void)
 {
     return hashtable_new(hashtable_hash_uint,
                          _Py_hashtable_compare_direct,
                          NULL,
-                         (_Py_hashtable_destroy_func)_Py_hashtable_destroy);
+                         tracemalloc_destroy_domain);
 }
 
 

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to