File tree Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 366
366
PYBIND11_WARNING_PUSH
367
367
PYBIND11_WARNING_DISABLE_CLANG(" -Wgnu-zero-variadic-macro-arguments" )
368
368
#define PYBIND11_MODULE_PYINIT (name, pre_init, ...) \
369
- static ::pybind11::module_::module_def PYBIND11_CONCAT (pybind11_module_def_, name); \
369
+ static PyModuleDef PYBIND11_CONCAT (pybind11_module_def_, name); \
370
370
static ::pybind11::module_::slots_array PYBIND11_CONCAT (pybind11_module_slots_, name); \
371
371
static int PYBIND11_CONCAT (pybind11_exec_, name)(PyObject *); \
372
372
static void PYBIND11_CONCAT (pybind11_init_, name)(::pybind11::module_ &); \
373
373
PYBIND11_PLUGIN_IMPL (name) { \
374
374
PYBIND11_CHECK_PYTHON_VERSION \
375
375
pre_init; \
376
376
PYBIND11_ENSURE_INTERNALS_READY \
377
- static auto def = []() { \
377
+ static PyModuleDef * def = []() { \
378
378
auto &slots = PYBIND11_CONCAT (pybind11_module_slots_, name); \
379
379
slots[0 ] = {Py_mod_exec, \
380
380
reinterpret_cast <void *>(&PYBIND11_CONCAT (pybind11_exec_, name))}; \
Original file line number Diff line number Diff line change @@ -1438,16 +1438,14 @@ class module_ : public object {
1438
1438
PyModule_AddObject (ptr (), name, obj.inc_ref ().ptr () /* steals a reference */ );
1439
1439
}
1440
1440
1441
- using module_def = PyModuleDef; // TODO: Can this be removed (it was needed only for Python 2)?
1442
-
1443
1441
/* * \rst
1444
1442
Create a new top-level module that can be used as the main module of a C extension.
1445
1443
1446
1444
``def`` should point to a statically allocated module_def.
1447
1445
\endrst */
1448
1446
static module_ create_extension_module (const char *name,
1449
1447
const char *doc,
1450
- module_def *def,
1448
+ PyModuleDef *def,
1451
1449
mod_gil_not_used gil_not_used
1452
1450
= mod_gil_not_used(false )) {
1453
1451
// module_def is PyModuleDef
@@ -1491,11 +1489,11 @@ class module_ : public object {
1491
1489
additional slots from the supplied options (and the empty sentinel slot).
1492
1490
\endrst */
1493
1491
template <typename ... Options>
1494
- static module_def *initialize_multiphase_module_def (const char *name,
1495
- const char *doc,
1496
- module_def *def,
1497
- slots_array &slots,
1498
- Options &&...options) {
1492
+ static PyModuleDef *initialize_multiphase_module_def (const char *name,
1493
+ const char *doc,
1494
+ PyModuleDef *def,
1495
+ slots_array &slots,
1496
+ Options &&...options) {
1499
1497
size_t next_slot = 0 ;
1500
1498
size_t term_slot = slots.size () - 1 ;
1501
1499
Original file line number Diff line number Diff line change @@ -78,8 +78,7 @@ TEST_SUBMODULE(modules, m) {
78
78
class DupeException {};
79
79
80
80
// Go ahead and leak, until we have a non-leaking py::module_ constructor
81
- auto dm
82
- = py::module_::create_extension_module (" dummy" , nullptr , new py::module_::module_def);
81
+ auto dm = py::module_::create_extension_module (" dummy" , nullptr , new PyModuleDef);
83
82
auto failures = py::list ();
84
83
85
84
py::class_<Dupe1>(dm, " Dupe1" );
You can’t perform that action at this time.
0 commit comments