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(_MSC_FULL_VER) 85 #elif defined(__VERSION__) 86 m.attr(
"compiler_info") = __VERSION__;
88 m.attr(
"compiler_info") = py::none();
95 #if defined(PYBIND11_DETAILED_ERROR_MESSAGES) 96 m.attr(
"detailed_error_messages_enabled") =
true;
98 m.attr(
"detailed_error_messages_enabled") =
false;
101 py::class_<UserType>(
m,
"UserType",
"A `py::class_` type for testing")
103 .def(py::init<int>())
105 .def(
"set_value", &
UserType::set,
"Set value using a method")
107 .def(
"__repr__", [](
const UserType &u) {
return "UserType({})"_s.format(u.value()); });
109 py::class_<IncType, UserType>(
m,
"IncType")
111 .def(py::init<int>())
112 .def(
"__repr__", [](
const IncType &u) {
return "IncType({})"_s.format(u.value()); });
int default_constructions
PYBIND11_NOINLINE internals & get_internals()
Return a reference to the current internals data.
#define PYBIND11_TOSTRING(x)
std::unordered_multimap< const void *, instance * > registered_instances
PYBIND11_MODULE(pybind11_tests, m)
test_initializer(Initializer init)
void(*)(py::module_ &) Initializer
static ConstructorStats & get()
std::list< std::function< void(py::module_ &)> > & initializers()
void bind_ConstructorStats(py::module_ &m)
#define PYBIND11_INTERNALS_ID
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...