| 1557 | /// Initialize an array of slots based on the supplied exec slot and options. |
| 1558 | template <typename... Options> |
| 1559 | inline slots_array init_slots(int (*exec_fn)(PyObject *), Options &&...options) noexcept { |
| 1560 | /* NOTE: slots_array MUST be large enough to hold all possible options. If you add an option |
| 1561 | here, you MUST also increase the size of slots_array in the type alias above! */ |
| 1562 | slots_array mod_def_slots; |
| 1563 | size_t next_slot = 0; |
| 1564 | |
| 1565 | mod_def_slots[next_slot++] = {Py_mod_create, reinterpret_cast<void *>(&cached_create_module)}; |
| 1566 | |
| 1567 | if (exec_fn != nullptr) { |
| 1568 | mod_def_slots[next_slot++] = {Py_mod_exec, reinterpret_cast<void *>(exec_fn)}; |
| 1569 | } |
| 1570 | |
| 1571 | #ifdef Py_mod_multiple_interpreters |
| 1572 | mod_def_slots[next_slot++] = {Py_mod_multiple_interpreters, multi_interp_slot(options...)}; |
| 1573 | #endif |
| 1574 | |
| 1575 | if (gil_not_used_option(options...)) { |
| 1576 | #if defined(Py_mod_gil) && defined(Py_GIL_DISABLED) |
| 1577 | mod_def_slots[next_slot++] = {Py_mod_gil, Py_MOD_GIL_NOT_USED}; |
| 1578 | #endif |
| 1579 | } |
| 1580 | |
| 1581 | // slots must have a zero end sentinel |
| 1582 | mod_def_slots[next_slot++] = {0, nullptr}; |
| 1583 | |
| 1584 | return mod_def_slots; |
| 1585 | } |
| 1586 | |
| 1587 | PYBIND11_NAMESPACE_END(detail) |
| 1588 |
nothing calls this directly
no test coverage detected