31 static std::list<std::function<void(py::module_ &)>> inits;
39 auto m = parent.def_submodule(submodule_name);
45 py::class_<ConstructorStats>(
m,
"ConstructorStats")
55 py::return_value_policy::reference_internal)
59 .def_static(
"detail_reg_inst", []() {
67 #if defined(PYBIND11_CPP20)
69 #elif defined(PYBIND11_CPP17)
71 #elif defined(PYBIND11_CPP14)
79 m.doc() =
"pybind11 test module";
83 #if defined(__VERSION__)
84 m.attr(
"compiler_info") = __VERSION__;
85 #elif defined(_MSC_FULL_VER)
88 m.attr(
"compiler_info") = py::none();
94 m.attr(
"PYBIND11_SIMPLE_GIL_MANAGEMENT") =
95 #if defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
100 m.attr(
"PYBIND11_NUMPY_1_ONLY") =
101 #if defined(PYBIND11_NUMPY_1_ONLY)
109 #if defined(PYBIND11_DETAILED_ERROR_MESSAGES)
110 m.attr(
"detailed_error_messages_enabled") =
true;
112 m.attr(
"detailed_error_messages_enabled") =
false;
115 py::class_<UserType>(
m,
"UserType",
"A `py::class_` type for testing")
117 .def(py::init<int>())
119 .def(
"set_value", &
UserType::set,
"Set value using a method")
121 .def(
"__repr__", [](
const UserType &u) {
return "UserType({})"_s.format(u.value()); });
123 py::class_<IncType, UserType>(
m,
"IncType")
125 .def(py::init<int>())
126 .def(
"__repr__", [](
const IncType &u) {
return "IncType({})"_s.format(u.value()); });