mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
refactor: module -> module_ with typedef (#2544)
* WIP: module -> module_ without typedef * refactor: allow py::module to work again
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
TEST_SUBMODULE(modules, m) {
|
||||
// test_nested_modules
|
||||
// This is intentionally "py::module" to verify it still can be used in place of "py::module_"
|
||||
py::module m_sub = m.def_submodule("subsubmodule");
|
||||
m_sub.def("submodule_func", []() { return "submodule_func()"; });
|
||||
|
||||
@@ -50,6 +51,7 @@ TEST_SUBMODULE(modules, m) {
|
||||
.def_readwrite("a1", &B::a1) // def_readonly uses an internal reference return policy by default
|
||||
.def_readwrite("a2", &B::a2);
|
||||
|
||||
// This is intentionally "py::module" to verify it still can be used in place of "py::module_"
|
||||
m.attr("OD") = py::module::import("collections").attr("OrderedDict");
|
||||
|
||||
// test_duplicate_registration
|
||||
@@ -60,7 +62,7 @@ TEST_SUBMODULE(modules, m) {
|
||||
class Dupe3 { };
|
||||
class DupeException { };
|
||||
|
||||
auto dm = py::module("dummy");
|
||||
auto dm = py::module_("dummy");
|
||||
auto failures = py::list();
|
||||
|
||||
py::class_<Dupe1>(dm, "Dupe1");
|
||||
|
||||
Reference in New Issue
Block a user