Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:51

0001 #include <pybind11/pybind11.h>
0002 
0003 namespace py = pybind11;
0004 
0005 /* Simple test module/test class to check that the referenced internals data of external pybind11
0006  * modules aren't preserved over a finalize/initialize.
0007  */
0008 
0009 PYBIND11_MODULE(external_module, m) {
0010     class A {
0011     public:
0012         explicit A(int value) : v{value} {};
0013         int v;
0014     };
0015 
0016     py::class_<A>(m, "A").def(py::init<int>()).def_readwrite("value", &A::v);
0017 
0018     m.def("internals_at",
0019           []() { return reinterpret_cast<uintptr_t>(&py::detail::get_internals()); });
0020 }