gh-111178: Fix function signatures for test_zoneinfo (#131664)

This commit is contained in:
Victor Stinner 2025-03-24 14:32:46 +01:00 committed by GitHub
parent abcd9d4f7d
commit 4596666a9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 */