mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
chore: rename generic slots variable (#5793)
* fix: better compatibility with Qt Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> style: pre-commit fixes * refactor: use mod_def_slots as a name instead Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -436,14 +436,14 @@ PyModuleDef_Init should be treated like any other PyObject (so not shared across
|
||||
PYBIND11_CHECK_PYTHON_VERSION \
|
||||
pre_init; \
|
||||
PYBIND11_ENSURE_INTERNALS_READY \
|
||||
static ::pybind11::detail::slots_array slots = ::pybind11::detail::init_slots( \
|
||||
static ::pybind11::detail::slots_array mod_def_slots = ::pybind11::detail::init_slots( \
|
||||
&PYBIND11_CONCAT(pybind11_exec_, name), ##__VA_ARGS__); \
|
||||
static PyModuleDef def{/* m_base */ PyModuleDef_HEAD_INIT, \
|
||||
/* m_name */ PYBIND11_TOSTRING(name), \
|
||||
/* m_doc */ nullptr, \
|
||||
/* m_size */ 0, \
|
||||
/* m_methods */ nullptr, \
|
||||
/* m_slots */ slots.data(), \
|
||||
/* m_slots */ mod_def_slots.data(), \
|
||||
/* m_traverse */ nullptr, \
|
||||
/* m_clear */ nullptr, \
|
||||
/* m_free */ nullptr}; \
|
||||
|
||||
@@ -1388,29 +1388,29 @@ template <typename... Options>
|
||||
inline slots_array init_slots(int (*exec_fn)(PyObject *), Options &&...options) noexcept {
|
||||
/* NOTE: slots_array MUST be large enough to hold all possible options. If you add an option
|
||||
here, you MUST also increase the size of slots_array in the type alias above! */
|
||||
slots_array slots;
|
||||
slots_array mod_def_slots;
|
||||
size_t next_slot = 0;
|
||||
|
||||
slots[next_slot++] = {Py_mod_create, reinterpret_cast<void *>(&cached_create_module)};
|
||||
mod_def_slots[next_slot++] = {Py_mod_create, reinterpret_cast<void *>(&cached_create_module)};
|
||||
|
||||
if (exec_fn != nullptr) {
|
||||
slots[next_slot++] = {Py_mod_exec, reinterpret_cast<void *>(exec_fn)};
|
||||
mod_def_slots[next_slot++] = {Py_mod_exec, reinterpret_cast<void *>(exec_fn)};
|
||||
}
|
||||
|
||||
#ifdef Py_mod_multiple_interpreters
|
||||
slots[next_slot++] = {Py_mod_multiple_interpreters, multi_interp_slot(options...)};
|
||||
mod_def_slots[next_slot++] = {Py_mod_multiple_interpreters, multi_interp_slot(options...)};
|
||||
#endif
|
||||
|
||||
if (gil_not_used_option(options...)) {
|
||||
#if defined(Py_mod_gil) && defined(Py_GIL_DISABLED)
|
||||
slots[next_slot++] = {Py_mod_gil, Py_MOD_GIL_NOT_USED};
|
||||
mod_def_slots[next_slot++] = {Py_mod_gil, Py_MOD_GIL_NOT_USED};
|
||||
#endif
|
||||
}
|
||||
|
||||
// slots must have a zero end sentinel
|
||||
slots[next_slot++] = {0, nullptr};
|
||||
mod_def_slots[next_slot++] = {0, nullptr};
|
||||
|
||||
return slots;
|
||||
return mod_def_slots;
|
||||
}
|
||||
|
||||
PYBIND11_NAMESPACE_END(detail)
|
||||
|
||||
Reference in New Issue
Block a user