Skip to content

Commit 08ee616

Browse files
committed
Make tokens const to pass check for C globals
1 parent 628942c commit 08ee616

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Modules/_testcapi/module.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ module_from_slots_gc(PyObject *self, PyObject *spec)
109109
return mod;
110110
}
111111

112-
static char test_token;
112+
static const char test_token;
113113

114114
static PyObject *
115115
module_from_slots_token(PyObject *self, PyObject *spec)
116116
{
117117
PyModuleDef_Slot slots[] = {
118-
{Py_mod_token, &test_token},
118+
{Py_mod_token, (void*)&test_token},
119119
{0},
120120
};
121121
PyObject *mod = PyModule_FromSlotsAndSpec(slots, spec);
@@ -368,7 +368,7 @@ _PyTestCapi_Init_Module(PyObject *m)
368368
ADD_INT_MACRO(Py_mod_token);
369369
#undef ADD_INT_MACRO
370370
if (PyModule_Add(m, "module_test_token",
371-
PyLong_FromVoidPtr(&test_token)) < 0)
371+
PyLong_FromVoidPtr((void*)&test_token)) < 0)
372372
{
373373
return -1;
374374
}

Modules/_testmultiphase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ modexport_smoke_get_state_int(PyObject *mod, PyObject *arg)
11191119
return PyLong_FromLong(*state);
11201120
}
11211121

1122-
static char modexport_smoke_test_token;
1122+
static const char modexport_smoke_test_token;
11231123

11241124
static PyObject *
11251125
modexport_smoke_get_test_token(PyObject *mod, PyObject *arg)

0 commit comments

Comments
 (0)