Skip to content

Commit a7fe951

Browse files
committed
And some free-threading warnings
1 parent 411305a commit a7fe951

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Modules/_testlimitedcapi/slots.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,20 @@ module_from_null_slot(PyObject* Py_UNUSED(module), PyObject *args)
589589
if (!PyArg_ParseTuple(args, "lO", &slot_number, &spec)) {
590590
return NULL;
591591
}
592+
uint16_t maybe_gil_slot = Py_mod_gil;
593+
if ((slot_number == 4) || (slot_number == 87)) {
594+
// Do not repeat the GIL slot
595+
maybe_gil_slot = Py_slot_invalid;
596+
}
592597
return PyModule_FromSlotsAndSpec((PySlot[]) {
593598
PySlot_DATA(Py_mod_abi, &abi_info),
594599
PySlot_DATA(Py_mod_name, "mymod"),
595600
PySlot_PTR_STATIC((uint16_t)slot_number, NULL),
601+
{
602+
.sl_id=maybe_gil_slot,
603+
.sl_flags=PySlot_OPTIONAL,
604+
.sl_ptr=Py_MOD_GIL_NOT_USED,
605+
},
596606
PySlot_END
597607
}, spec);
598608
}

Modules/_testmultiphase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ PyModExport__test_from_modexport(void)
10551055
PySlot_DATA(Py_mod_abi, &abi_info),
10561056
PySlot_DATA(Py_mod_name, "_test_from_modexport"),
10571057
PySlot_DATA(Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED),
1058-
PySlot_DATA(Py_mod_gil, Py_MOD_GIL_USED),
1058+
PySlot_DATA(Py_mod_gil, Py_MOD_GIL_NOT_USED),
10591059
PySlot_END,
10601060
};
10611061
return slots;

0 commit comments

Comments
 (0)