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", []() {
61 return py::detail::get_internals().registered_instances.size();
66 m.doc() =
"pybind11 test module";
71 m.attr(
"debug_enabled") =
true;
73 m.attr(
"debug_enabled") =
false;
76 py::class_<UserType>(m,
"UserType",
"A `py::class_` type for testing")
82 .def(
"__repr__", [](
const UserType &u) {
return "UserType({})"_s.format(u.
value()); });
84 py::class_<IncType, UserType>(m,
"IncType")
87 .def(
"__repr__", [](
const IncType &u) {
return "IncType({})"_s.format(u.
value()); });
int default_constructions
static ConstructorStats & get()
Like UserType, but increments value on copy for quick reference vs. copy tests.
A user-defined type which is exported and can be used by any test.
void(*)(py::module_ &) Initializer
test_initializer(Initializer init)
#define PYBIND11_MODULE(name, variable)
\rst This macro creates the entry point that will be invoked when the Python interpreter imports an e...
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
void bind_ConstructorStats(py::module_ &m)
std::list< std::function< void(py::module_ &)> > & initializers()