Skip to content

Commit adb5603

Browse files
authored
chore: rename generic slots variable (#5793)
* fix: better compatibility with Qt Signed-off-by: Henry Schreiner <[email protected]> style: pre-commit fixes * refactor: use mod_def_slots as a name instead Signed-off-by: Henry Schreiner <[email protected]> --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent 7aa3780 commit adb5603

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

include/pybind11/detail/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,14 @@ PyModuleDef_Init should be treated like any other PyObject (so not shared across
436436
PYBIND11_CHECK_PYTHON_VERSION \
437437
pre_init; \
438438
PYBIND11_ENSURE_INTERNALS_READY \
439-
static ::pybind11::detail::slots_array slots = ::pybind11::detail::init_slots( \
439+
static ::pybind11::detail::slots_array mod_def_slots = ::pybind11::detail::init_slots( \
440440
&PYBIND11_CONCAT(pybind11_exec_, name), ##__VA_ARGS__); \
441441
static PyModuleDef def{/* m_base */ PyModuleDef_HEAD_INIT, \
442442
/* m_name */ PYBIND11_TOSTRING(name), \
443443
/* m_doc */ nullptr, \
444444
/* m_size */ 0, \
445445
/* m_methods */ nullptr, \
446-
/* m_slots */ slots.data(), \
446+
/* m_slots */ mod_def_slots.data(), \
447447
/* m_traverse */ nullptr, \
448448
/* m_clear */ nullptr, \
449449
/* m_free */ nullptr}; \

include/pybind11/pybind11.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,29 +1388,29 @@ template <typename... Options>
13881388
inline slots_array init_slots(int (*exec_fn)(PyObject *), Options &&...options) noexcept {
13891389
/* NOTE: slots_array MUST be large enough to hold all possible options. If you add an option
13901390
here, you MUST also increase the size of slots_array in the type alias above! */
1391-
slots_array slots;
1391+
slots_array mod_def_slots;
13921392
size_t next_slot = 0;
13931393

1394-
slots[next_slot++] = {Py_mod_create, reinterpret_cast<void *>(&cached_create_module)};
1394+
mod_def_slots[next_slot++] = {Py_mod_create, reinterpret_cast<void *>(&cached_create_module)};
13951395

13961396
if (exec_fn != nullptr) {
1397-
slots[next_slot++] = {Py_mod_exec, reinterpret_cast<void *>(exec_fn)};
1397+
mod_def_slots[next_slot++] = {Py_mod_exec, reinterpret_cast<void *>(exec_fn)};
13981398
}
13991399

14001400
#ifdef Py_mod_multiple_interpreters
1401-
slots[next_slot++] = {Py_mod_multiple_interpreters, multi_interp_slot(options...)};
1401+
mod_def_slots[next_slot++] = {Py_mod_multiple_interpreters, multi_interp_slot(options...)};
14021402
#endif
14031403

14041404
if (gil_not_used_option(options...)) {
14051405
#if defined(Py_mod_gil) && defined(Py_GIL_DISABLED)
1406-
slots[next_slot++] = {Py_mod_gil, Py_MOD_GIL_NOT_USED};
1406+
mod_def_slots[next_slot++] = {Py_mod_gil, Py_MOD_GIL_NOT_USED};
14071407
#endif
14081408
}
14091409

14101410
// slots must have a zero end sentinel
1411-
slots[next_slot++] = {0, nullptr};
1411+
mod_def_slots[next_slot++] = {0, nullptr};
14121412

1413-
return slots;
1413+
return mod_def_slots;
14141414
}
14151415

14161416
PYBIND11_NAMESPACE_END(detail)

0 commit comments

Comments
 (0)