Skip to content

Commit 391281d

Browse files
committed
Put const in signatures
1 parent dd3c25f commit 391281d

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Include/moduleobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ PyAPI_FUNC(int) PyUnstable_Module_SetGIL(PyObject *module, void *gil);
120120
#endif
121121

122122
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= _Py_PACK_VERSION(3, 15)
123-
PyAPI_FUNC(PyObject *) PyModule_FromSlotsAndSpec(PyModuleDef_Slot *,
123+
PyAPI_FUNC(PyObject *) PyModule_FromSlotsAndSpec(const PyModuleDef_Slot *,
124124
PyObject *spec);
125125
PyAPI_FUNC(int) PyModule_Exec(PyObject *mod);
126126
PyAPI_FUNC(int) PyModule_GetStateSize(PyObject *mod, Py_ssize_t *size_p);

Include/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ PyAPI_FUNC(int) PyType_Freeze(PyTypeObject *type);
835835
#endif
836836

837837
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= _Py_PACK_VERSION(3, 15)
838-
PyAPI_FUNC(PyObject *) PyType_GetModuleByToken(PyTypeObject *, void *);
838+
PyAPI_FUNC(PyObject *) PyType_GetModuleByToken(PyTypeObject *, const void *);
839839
#endif
840840

841841
#ifdef __cplusplus

Objects/moduleobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ PyModule_FromDefAndSpec2(PyModuleDef* def, PyObject *spec, int module_api_versio
639639
}
640640

641641
PyObject *
642-
PyModule_FromSlotsAndSpec(PyModuleDef_Slot *slots, PyObject *spec)
642+
PyModule_FromSlotsAndSpec(const PyModuleDef_Slot *slots, PyObject *spec)
643643
{
644644
if (!slots) {
645645
PyErr_Format(
@@ -648,7 +648,7 @@ PyModule_FromSlotsAndSpec(PyModuleDef_Slot *slots, PyObject *spec)
648648
return NULL;
649649
}
650650
// Fill in enough of a PyModuleDef to pass to common machinery
651-
PyModuleDef def_like = {.m_slots = slots};
651+
PyModuleDef def_like = {.m_slots = (PyModuleDef_Slot *)slots};
652652

653653
return module_from_def_and_spec(&def_like, spec, PYTHON_API_VERSION,
654654
NULL);

Objects/typeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5768,7 +5768,7 @@ PyType_GetModuleState(PyTypeObject *type)
57685768
* has the given token.
57695769
*/
57705770
PyObject *
5771-
borrow_module_by_token(PyTypeObject *type, void *token)
5771+
borrow_module_by_token(PyTypeObject *type, const void *token)
57725772
{
57735773
assert(PyType_Check(type));
57745774

@@ -5833,7 +5833,7 @@ PyType_GetModuleByDef(PyTypeObject *type, PyModuleDef *def)
58335833
}
58345834

58355835
PyObject *
5836-
PyType_GetModuleByToken(PyTypeObject *type, void *token)
5836+
PyType_GetModuleByToken(PyTypeObject *type, const void *token)
58375837
{
58385838
return Py_XNewRef(borrow_module_by_token(type, token));
58395839
}

0 commit comments

Comments
 (0)