refactor: module -> module_ with typedef (#2544)
* WIP: module -> module_ without typedef
* refactor: allow py::module to work again
diff --git a/tests/constructor_stats.h b/tests/constructor_stats.h
index abfaf91..805968a 100644
--- a/tests/constructor_stats.h
+++ b/tests/constructor_stats.h
@@ -120,7 +120,7 @@
throw py::error_already_set();
Py_DECREF(result);
#else
- py::module::import("gc").attr("collect")();
+ py::module_::import("gc").attr("collect")();
#endif
}
diff --git a/tests/pybind11_tests.cpp b/tests/pybind11_tests.cpp
index 24b65df..439cd40 100644
--- a/tests/pybind11_tests.cpp
+++ b/tests/pybind11_tests.cpp
@@ -26,8 +26,8 @@
Instead, see the "How can I reduce the build time?" question in the "Frequently asked questions"
section of the documentation for good practice on splitting binding code over multiple files.
*/
-std::list<std::function<void(py::module &)>> &initializers() {
- static std::list<std::function<void(py::module &)>> inits;
+std::list<std::function<void(py::module_ &)>> &initializers() {
+ static std::list<std::function<void(py::module_ &)>> inits;
return inits;
}
@@ -36,13 +36,13 @@
}
test_initializer::test_initializer(const char *submodule_name, Initializer init) {
- initializers().emplace_back([=](py::module &parent) {
+ initializers().emplace_back([=](py::module_ &parent) {
auto m = parent.def_submodule(submodule_name);
init(m);
});
}
-void bind_ConstructorStats(py::module &m) {
+void bind_ConstructorStats(py::module_ &m) {
py::class_<ConstructorStats>(m, "ConstructorStats")
.def("alive", &ConstructorStats::alive)
.def("values", &ConstructorStats::values)
diff --git a/tests/pybind11_tests.h b/tests/pybind11_tests.h
index 247f799..4ff56c0 100644
--- a/tests/pybind11_tests.h
+++ b/tests/pybind11_tests.h
@@ -10,7 +10,7 @@
using namespace pybind11::literals;
class test_initializer {
- using Initializer = void (*)(py::module &);
+ using Initializer = void (*)(py::module_ &);
public:
test_initializer(Initializer init);
@@ -18,9 +18,9 @@
};
#define TEST_SUBMODULE(name, variable) \
- void test_submodule_##name(py::module &); \
+ void test_submodule_##name(py::module_ &); \
test_initializer name(#name, test_submodule_##name); \
- void test_submodule_##name(py::module &variable)
+ void test_submodule_##name(py::module_ &variable)
/// Dummy type which is not exported anywhere -- something to trigger a conversion error
diff --git a/tests/test_async.cpp b/tests/test_async.cpp
index f0ad0d5..e6e01d7 100644
--- a/tests/test_async.cpp
+++ b/tests/test_async.cpp
@@ -18,7 +18,7 @@
.def(py::init<>())
.def("__await__", [](const SupportsAsync& self) -> py::object {
static_cast<void>(self);
- py::object loop = py::module::import("asyncio.events").attr("get_event_loop")();
+ py::object loop = py::module_::import("asyncio.events").attr("get_event_loop")();
py::object f = loop.attr("create_future")();
f.attr("set_result")(5);
return f.attr("__await__")();
diff --git a/tests/test_class.cpp b/tests/test_class.cpp
index 3ca9d2a..2d4aef7 100644
--- a/tests/test_class.cpp
+++ b/tests/test_class.cpp
@@ -172,12 +172,12 @@
struct MismatchDerived2 : MismatchBase2 { };
m.def("mismatched_holder_1", []() {
- auto mod = py::module::import("__main__");
+ auto mod = py::module_::import("__main__");
py::class_<MismatchBase1, std::shared_ptr<MismatchBase1>>(mod, "MismatchBase1");
py::class_<MismatchDerived1, MismatchBase1>(mod, "MismatchDerived1");
});
m.def("mismatched_holder_2", []() {
- auto mod = py::module::import("__main__");
+ auto mod = py::module_::import("__main__");
py::class_<MismatchBase2>(mod, "MismatchBase2");
py::class_<MismatchDerived2, std::shared_ptr<MismatchDerived2>,
MismatchBase2>(mod, "MismatchDerived2");
diff --git a/tests/test_cmake_build/embed.cpp b/tests/test_cmake_build/embed.cpp
index b9581d2..a3abc8a 100644
--- a/tests/test_cmake_build/embed.cpp
+++ b/tests/test_cmake_build/embed.cpp
@@ -12,10 +12,10 @@
py::scoped_interpreter guard{};
- auto m = py::module::import("test_cmake_build");
+ auto m = py::module_::import("test_cmake_build");
if (m.attr("add")(1, 2).cast<int>() != 3)
throw std::runtime_error("embed.cpp failed");
- py::module::import("sys").attr("argv") = py::make_tuple("test.py", "embed.cpp");
+ py::module_::import("sys").attr("argv") = py::make_tuple("test.py", "embed.cpp");
py::eval_file(test_py_file, py::globals());
}
diff --git a/tests/test_eigen.cpp b/tests/test_eigen.cpp
index 56aa1a4..807d0a3 100644
--- a/tests/test_eigen.cpp
+++ b/tests/test_eigen.cpp
@@ -317,11 +317,11 @@
// a new array (np.ones(10)) increases the chances that the temp array will be garbage
// collected and/or that its memory will be overridden with different values.
m.def("get_elem_direct", [](Eigen::Ref<const Eigen::VectorXd> v) {
- py::module::import("numpy").attr("ones")(10);
+ py::module_::import("numpy").attr("ones")(10);
return v(5);
});
m.def("get_elem_indirect", [](std::vector<Eigen::Ref<const Eigen::VectorXd>> v) {
- py::module::import("numpy").attr("ones")(10);
+ py::module_::import("numpy").attr("ones")(10);
return v[0](5);
});
}
diff --git a/tests/test_embed/test_interpreter.cpp b/tests/test_embed/test_interpreter.cpp
index 753ce54..944334c 100644
--- a/tests/test_embed/test_interpreter.cpp
+++ b/tests/test_embed/test_interpreter.cpp
@@ -51,17 +51,17 @@
}
TEST_CASE("Pass classes and data between modules defined in C++ and Python") {
- auto module = py::module::import("test_interpreter");
- REQUIRE(py::hasattr(module, "DerivedWidget"));
+ auto module_ = py::module_::import("test_interpreter");
+ REQUIRE(py::hasattr(module_, "DerivedWidget"));
- auto locals = py::dict("hello"_a="Hello, World!", "x"_a=5, **module.attr("__dict__"));
+ auto locals = py::dict("hello"_a="Hello, World!", "x"_a=5, **module_.attr("__dict__"));
py::exec(R"(
widget = DerivedWidget("{} - {}".format(hello, x))
message = widget.the_message
)", py::globals(), locals);
REQUIRE(locals["message"].cast<std::string>() == "Hello, World! - 5");
- auto py_widget = module.attr("DerivedWidget")("The question");
+ auto py_widget = module_.attr("DerivedWidget")("The question");
auto message = py_widget.attr("the_message");
REQUIRE(message.cast<std::string>() == "The question");
@@ -70,10 +70,10 @@
}
TEST_CASE("Import error handling") {
- REQUIRE_NOTHROW(py::module::import("widget_module"));
- REQUIRE_THROWS_WITH(py::module::import("throw_exception"),
+ REQUIRE_NOTHROW(py::module_::import("widget_module"));
+ REQUIRE_THROWS_WITH(py::module_::import("throw_exception"),
"ImportError: C++ Error");
- REQUIRE_THROWS_WITH(py::module::import("throw_error_already_set"),
+ REQUIRE_THROWS_WITH(py::module_::import("throw_error_already_set"),
Catch::Contains("ImportError: KeyError"));
}
@@ -107,14 +107,14 @@
TEST_CASE("Restart the interpreter") {
// Verify pre-restart state.
- REQUIRE(py::module::import("widget_module").attr("add")(1, 2).cast<int>() == 3);
+ REQUIRE(py::module_::import("widget_module").attr("add")(1, 2).cast<int>() == 3);
REQUIRE(has_pybind11_internals_builtin());
REQUIRE(has_pybind11_internals_static());
- REQUIRE(py::module::import("external_module").attr("A")(123).attr("value").cast<int>() == 123);
+ REQUIRE(py::module_::import("external_module").attr("A")(123).attr("value").cast<int>() == 123);
// local and foreign module internals should point to the same internals:
REQUIRE(reinterpret_cast<uintptr_t>(*py::detail::get_internals_pp()) ==
- py::module::import("external_module").attr("internals_at")().cast<uintptr_t>());
+ py::module_::import("external_module").attr("internals_at")().cast<uintptr_t>());
// Restart the interpreter.
py::finalize_interpreter();
@@ -130,14 +130,14 @@
REQUIRE(has_pybind11_internals_builtin());
REQUIRE(has_pybind11_internals_static());
REQUIRE(reinterpret_cast<uintptr_t>(*py::detail::get_internals_pp()) ==
- py::module::import("external_module").attr("internals_at")().cast<uintptr_t>());
+ py::module_::import("external_module").attr("internals_at")().cast<uintptr_t>());
// Make sure that an interpreter with no get_internals() created until finalize still gets the
// internals destroyed
py::finalize_interpreter();
py::initialize_interpreter();
bool ran = false;
- py::module::import("__main__").attr("internals_destroy_test") =
+ py::module_::import("__main__").attr("internals_destroy_test") =
py::capsule(&ran, [](void *ran) { py::detail::get_internals(); *static_cast<bool *>(ran) = true; });
REQUIRE_FALSE(has_pybind11_internals_builtin());
REQUIRE_FALSE(has_pybind11_internals_static());
@@ -149,20 +149,20 @@
REQUIRE_FALSE(has_pybind11_internals_static());
// C++ modules can be reloaded.
- auto cpp_module = py::module::import("widget_module");
+ auto cpp_module = py::module_::import("widget_module");
REQUIRE(cpp_module.attr("add")(1, 2).cast<int>() == 3);
// C++ type information is reloaded and can be used in python modules.
- auto py_module = py::module::import("test_interpreter");
+ auto py_module = py::module_::import("test_interpreter");
auto py_widget = py_module.attr("DerivedWidget")("Hello after restart");
REQUIRE(py_widget.attr("the_message").cast<std::string>() == "Hello after restart");
}
TEST_CASE("Subinterpreter") {
// Add tags to the modules in the main interpreter and test the basics.
- py::module::import("__main__").attr("main_tag") = "main interpreter";
+ py::module_::import("__main__").attr("main_tag") = "main interpreter";
{
- auto m = py::module::import("widget_module");
+ auto m = py::module_::import("widget_module");
m.attr("extension_module_tag") = "added to module in main interpreter";
REQUIRE(m.attr("add")(1, 2).cast<int>() == 3);
@@ -181,9 +181,9 @@
REQUIRE(has_pybind11_internals_static());
// Modules tags should be gone.
- REQUIRE_FALSE(py::hasattr(py::module::import("__main__"), "tag"));
+ REQUIRE_FALSE(py::hasattr(py::module_::import("__main__"), "tag"));
{
- auto m = py::module::import("widget_module");
+ auto m = py::module_::import("widget_module");
REQUIRE_FALSE(py::hasattr(m, "extension_module_tag"));
// Function bindings should still work.
@@ -194,8 +194,8 @@
Py_EndInterpreter(sub_tstate);
PyThreadState_Swap(main_tstate);
- REQUIRE(py::hasattr(py::module::import("__main__"), "main_tag"));
- REQUIRE(py::hasattr(py::module::import("widget_module"), "extension_module_tag"));
+ REQUIRE(py::hasattr(py::module_::import("__main__"), "main_tag"));
+ REQUIRE(py::hasattr(py::module_::import("widget_module"), "extension_module_tag"));
}
TEST_CASE("Execution frame") {
@@ -245,7 +245,7 @@
// Disable generation of cached bytecode (.pyc files) for this test, otherwise
// Python might pick up an old version from the cache instead of the new versions
// of the .py files generated below
- auto sys = py::module::import("sys");
+ auto sys = py::module_::import("sys");
bool dont_write_bytecode = sys.attr("dont_write_bytecode").cast<bool>();
sys.attr("dont_write_bytecode") = true;
// Reset the value at scope exit
@@ -267,8 +267,8 @@
});
// Import the module from file
- auto module = py::module::import(module_name.c_str());
- int result = module.attr("test")().cast<int>();
+ auto module_ = py::module_::import(module_name.c_str());
+ int result = module_.attr("test")().cast<int>();
REQUIRE(result == 1);
// Update the module .py file with a small change
@@ -278,7 +278,7 @@
test_module.close();
// Reload the module
- module.reload();
- result = module.attr("test")().cast<int>();
+ module_.reload();
+ result = module_.attr("test")().cast<int>();
REQUIRE(result == 2);
}
diff --git a/tests/test_eval.cpp b/tests/test_eval.cpp
index e094821..03d0fb3 100644
--- a/tests/test_eval.cpp
+++ b/tests/test_eval.cpp
@@ -14,7 +14,7 @@
TEST_SUBMODULE(eval_, m) {
// test_evals
- auto global = py::dict(py::module::import("__main__").attr("__dict__"));
+ auto global = py::dict(py::module_::import("__main__").attr("__dict__"));
m.def("test_eval_statements", [global]() {
auto local = py::dict();
diff --git a/tests/test_exceptions.cpp b/tests/test_exceptions.cpp
index 6187f2e..b95ff47 100644
--- a/tests/test_exceptions.cpp
+++ b/tests/test_exceptions.cpp
@@ -163,7 +163,7 @@
m.def("modulenotfound_exception_matches_base", []() {
try {
// On Python >= 3.6, this raises a ModuleNotFoundError, a subclass of ImportError
- py::module::import("nonexistent");
+ py::module_::import("nonexistent");
}
catch (py::error_already_set &ex) {
if (!ex.matches(PyExc_ImportError)) throw;
diff --git a/tests/test_factory_constructors.cpp b/tests/test_factory_constructors.cpp
index 2368dab..f42d1f2 100644
--- a/tests/test_factory_constructors.cpp
+++ b/tests/test_factory_constructors.cpp
@@ -142,7 +142,7 @@
TEST_SUBMODULE(factory_constructors, m) {
// Define various trivial types to allow simpler overload resolution:
- py::module m_tag = m.def_submodule("tag");
+ py::module_ m_tag = m.def_submodule("tag");
#define MAKE_TAG_TYPE(Name) \
struct Name##_tag {}; \
py::class_<Name##_tag>(m_tag, #Name "_tag").def(py::init<>()); \
diff --git a/tests/test_gil_scoped.cpp b/tests/test_gil_scoped.cpp
index eb63089..b6a45a5 100644
--- a/tests/test_gil_scoped.cpp
+++ b/tests/test_gil_scoped.cpp
@@ -45,7 +45,7 @@
[](VirtClass &virt) { virt.pure_virtual_func(); });
m.def("test_cross_module_gil",
[]() {
- auto cm = py::module::import("cross_module_gil_utils");
+ auto cm = py::module_::import("cross_module_gil_utils");
auto gil_acquire = reinterpret_cast<void (*)()>(
PyLong_AsVoidPtr(cm.attr("gil_acquire_funcaddr").ptr()));
py::gil_scoped_release gil_release;
diff --git a/tests/test_iostream.cpp b/tests/test_iostream.cpp
index e67f88a..e916150 100644
--- a/tests/test_iostream.cpp
+++ b/tests/test_iostream.cpp
@@ -37,7 +37,7 @@
});
m.def("captured_output", [](std::string msg) {
- py::scoped_ostream_redirect redir(std::cout, py::module::import("sys").attr("stdout"));
+ py::scoped_ostream_redirect redir(std::cout, py::module_::import("sys").attr("stdout"));
std::cout << msg << std::flush;
});
@@ -46,7 +46,7 @@
py::arg("msg"), py::arg("flush")=true);
m.def("captured_err", [](std::string msg) {
- py::scoped_ostream_redirect redir(std::cerr, py::module::import("sys").attr("stderr"));
+ py::scoped_ostream_redirect redir(std::cerr, py::module_::import("sys").attr("stderr"));
std::cerr << msg << std::flush;
});
@@ -65,8 +65,8 @@
});
m.def("captured_dual", [](std::string msg, std::string emsg) {
- py::scoped_ostream_redirect redirout(std::cout, py::module::import("sys").attr("stdout"));
- py::scoped_ostream_redirect redirerr(std::cerr, py::module::import("sys").attr("stderr"));
+ py::scoped_ostream_redirect redirout(std::cout, py::module_::import("sys").attr("stdout"));
+ py::scoped_ostream_redirect redirerr(std::cerr, py::module_::import("sys").attr("stderr"));
std::cout << msg << std::flush;
std::cerr << emsg << std::flush;
});
diff --git a/tests/test_kwargs_and_defaults.cpp b/tests/test_kwargs_and_defaults.cpp
index 641ec88..7bda708 100644
--- a/tests/test_kwargs_and_defaults.cpp
+++ b/tests/test_kwargs_and_defaults.cpp
@@ -107,7 +107,7 @@
return py::make_tuple(i, j, k, kwargs); },
py::arg() /* positional */, py::arg("j") = -1 /* both */, py::kw_only(), py::arg("k") /* kw-only */);
- m.def("register_invalid_kw_only", [](py::module m) {
+ m.def("register_invalid_kw_only", [](py::module_ m) {
m.def("bad_kw_only", [](int i, int j) { return py::make_tuple(i, j); },
py::kw_only(), py::arg() /* invalid unnamed argument */, "j"_a);
});
@@ -138,5 +138,5 @@
// Make sure a class (not an instance) can be used as a default argument.
// The return value doesn't matter, only that the module is importable.
m.def("class_default_argument", [](py::object a) { return py::repr(a); },
- "a"_a = py::module::import("decimal").attr("Decimal"));
+ "a"_a = py::module_::import("decimal").attr("Decimal"));
}
diff --git a/tests/test_local_bindings.cpp b/tests/test_local_bindings.cpp
index 97c02db..c61e388 100644
--- a/tests/test_local_bindings.cpp
+++ b/tests/test_local_bindings.cpp
@@ -41,7 +41,7 @@
// should raise a runtime error from the duplicate definition attempt. If test_class isn't
// available it *also* throws a runtime error (with "test_class not enabled" as value).
m.def("register_local_external", [m]() {
- auto main = py::module::import("pybind11_tests");
+ auto main = py::module_::import("pybind11_tests");
if (py::hasattr(main, "class_")) {
bind_local<LocalExternal, 7>(m, "LocalExternal", py::module_local());
}
diff --git a/tests/test_methods_and_attributes.cpp b/tests/test_methods_and_attributes.cpp
index 11d4e7b..b6df41d 100644
--- a/tests/test_methods_and_attributes.cpp
+++ b/tests/test_methods_and_attributes.cpp
@@ -207,12 +207,12 @@
// test_no_mixed_overloads
// Raise error if trying to mix static/non-static overloads on the same name:
.def_static("add_mixed_overloads1", []() {
- auto emna = py::reinterpret_borrow<py::class_<ExampleMandA>>(py::module::import("pybind11_tests.methods_and_attributes").attr("ExampleMandA"));
+ auto emna = py::reinterpret_borrow<py::class_<ExampleMandA>>(py::module_::import("pybind11_tests.methods_and_attributes").attr("ExampleMandA"));
emna.def ("overload_mixed1", static_cast<py::str (ExampleMandA::*)(int, int)>(&ExampleMandA::overloaded))
.def_static("overload_mixed1", static_cast<py::str ( *)(float )>(&ExampleMandA::overloaded));
})
.def_static("add_mixed_overloads2", []() {
- auto emna = py::reinterpret_borrow<py::class_<ExampleMandA>>(py::module::import("pybind11_tests.methods_and_attributes").attr("ExampleMandA"));
+ auto emna = py::reinterpret_borrow<py::class_<ExampleMandA>>(py::module_::import("pybind11_tests.methods_and_attributes").attr("ExampleMandA"));
emna.def_static("overload_mixed2", static_cast<py::str ( *)(float )>(&ExampleMandA::overloaded))
.def ("overload_mixed2", static_cast<py::str (ExampleMandA::*)(int, int)>(&ExampleMandA::overloaded));
})
@@ -308,11 +308,11 @@
m.attr("debug_enabled") = false;
#endif
m.def("bad_arg_def_named", []{
- auto m = py::module::import("pybind11_tests");
+ auto m = py::module_::import("pybind11_tests");
m.def("should_fail", [](int, UnregisteredType) {}, py::arg(), py::arg("a") = UnregisteredType());
});
m.def("bad_arg_def_unnamed", []{
- auto m = py::module::import("pybind11_tests");
+ auto m = py::module_::import("pybind11_tests");
m.def("should_fail", [](int, UnregisteredType) {}, py::arg(), py::arg() = UnregisteredType());
});
diff --git a/tests/test_modules.cpp b/tests/test_modules.cpp
index c1475fa..897cf89 100644
--- a/tests/test_modules.cpp
+++ b/tests/test_modules.cpp
@@ -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 @@
.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 @@
class Dupe3 { };
class DupeException { };
- auto dm = py::module("dummy");
+ auto dm = py::module_("dummy");
auto failures = py::list();
py::class_<Dupe1>(dm, "Dupe1");
diff --git a/tests/test_numpy_array.cpp b/tests/test_numpy_array.cpp
index c6bc5e0..753fa9f 100644
--- a/tests/test_numpy_array.cpp
+++ b/tests/test_numpy_array.cpp
@@ -22,7 +22,7 @@
template <typename T>
DtypeCheck get_dtype_check(const char* name) {
- py::module np = py::module::import("numpy");
+ py::module_ np = py::module_::import("numpy");
DtypeCheck check{};
check.numpy = np.attr("dtype")(np.attr(name));
check.pybind11 = py::dtype::of<T>();
@@ -133,7 +133,7 @@
static int data_i = 42;
TEST_SUBMODULE(numpy_array, sm) {
- try { py::module::import("numpy"); }
+ try { py::module_::import("numpy"); }
catch (...) { return; }
// test_dtypes
diff --git a/tests/test_numpy_dtypes.cpp b/tests/test_numpy_dtypes.cpp
index f235831..c4ab02b 100644
--- a/tests/test_numpy_dtypes.cpp
+++ b/tests/test_numpy_dtypes.cpp
@@ -255,7 +255,7 @@
struct B {};
TEST_SUBMODULE(numpy_dtypes, m) {
- try { py::module::import("numpy"); }
+ try { py::module_::import("numpy"); }
catch (...) { return; }
// typeinfo may be registered before the dtype descriptor for scalar casts to work...
diff --git a/tests/test_numpy_vectorize.cpp b/tests/test_numpy_vectorize.cpp
index 1f2de5f..aa8a881 100644
--- a/tests/test_numpy_vectorize.cpp
+++ b/tests/test_numpy_vectorize.cpp
@@ -17,7 +17,7 @@
}
TEST_SUBMODULE(numpy_vectorize, m) {
- try { py::module::import("numpy"); }
+ try { py::module_::import("numpy"); }
catch (...) { return; }
// test_vectorize, test_docs, test_array_collapse
diff --git a/tests/test_pytypes.cpp b/tests/test_pytypes.cpp
index 9384c92..d38ea19 100644
--- a/tests/test_pytypes.cpp
+++ b/tests/test_pytypes.cpp
@@ -289,7 +289,7 @@
py::print("no new line here", "end"_a=" -- ");
py::print("next print");
- auto py_stderr = py::module::import("sys").attr("stderr");
+ auto py_stderr = py::module_::import("sys").attr("stderr");
py::print("this goes to stderr", "file"_a=py_stderr);
py::print("flush", "flush"_a=true);
diff --git a/tests/test_stl_binders.cpp b/tests/test_stl_binders.cpp
index 8688874..1c0df98 100644
--- a/tests/test_stl_binders.cpp
+++ b/tests/test_stl_binders.cpp
@@ -117,7 +117,7 @@
});
// The rest depends on numpy:
- try { py::module::import("numpy"); }
+ try { py::module_::import("numpy"); }
catch (...) { return; }
// test_vector_buffer_numpy
diff --git a/tests/test_virtual_functions.cpp b/tests/test_virtual_functions.cpp
index 4fc04ac..685d64a 100644
--- a/tests/test_virtual_functions.cpp
+++ b/tests/test_virtual_functions.cpp
@@ -187,7 +187,7 @@
// Forward declaration (so that we can put the main tests here; the inherited virtual approaches are
// rather long).
-void initialize_inherited_virtuals(py::module &m);
+void initialize_inherited_virtuals(py::module_ &m);
TEST_SUBMODULE(virtual_functions, m) {
// test_override
@@ -459,7 +459,7 @@
};
*/
-void initialize_inherited_virtuals(py::module &m) {
+void initialize_inherited_virtuals(py::module_ &m) {
// test_inherited_virtuals
// Method 1: repeat