diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 7fc7dbf723..4387c2754b 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1322,7 +1322,7 @@ PYBIND11_NAMESPACE_BEGIN(detail) template <> struct handle_type_name { - static constexpr auto name = const_name("module"); + static constexpr auto name = const_name("types.ModuleType"); }; PYBIND11_NAMESPACE_END(detail) diff --git a/tests/test_modules.py b/tests/test_modules.py index 436271a701..ad898be89a 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -81,6 +81,13 @@ def test_pydoc(): assert pydoc.text.docmodule(pybind11_tests) +def test_module_handle_type_name(): + assert ( + m.def_submodule.__doc__ + == "def_submodule(arg0: types.ModuleType, arg1: str) -> types.ModuleType\n" + ) + + def test_duplicate_registration(): """Registering two things with the same name"""