From 00cd1e13138bfb6fed35118c810676fb22e4dc94 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 24 Mar 2025 14:04:28 +0100 Subject: [PATCH] gh-111178: Fix function signatures for test_zoneinfo --- Modules/_zoneinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index 7e761b287792e1..b736b7e04986d5 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -2580,14 +2580,14 @@ initialize_caches(zoneinfo_state *state) } static PyObject * -zoneinfo_init_subclass(PyTypeObject *cls, PyObject *args, PyObject **kwargs) +zoneinfo_init_subclass(PyObject *cls, PyObject *args, PyObject *kwargs) { PyObject *weak_cache = new_weak_cache(); if (weak_cache == NULL) { return NULL; } - if (PyObject_SetAttrString((PyObject *)cls, "_weak_cache", + if (PyObject_SetAttrString(cls, "_weak_cache", weak_cache) < 0) { Py_DECREF(weak_cache); return NULL; @@ -2611,7 +2611,7 @@ static PyMethodDef zoneinfo_methods[] = { {"__reduce__", (PyCFunction)zoneinfo_reduce, METH_NOARGS, PyDoc_STR("Function for serialization with the pickle protocol.")}, ZONEINFO_ZONEINFO__UNPICKLE_METHODDEF - {"__init_subclass__", (PyCFunction)(void (*)(void))zoneinfo_init_subclass, + {"__init_subclass__", _PyCFunction_CAST(zoneinfo_init_subclass), METH_VARARGS | METH_KEYWORDS | METH_CLASS, PyDoc_STR("Function to initialize subclasses.")}, {NULL} /* Sentinel */