From 444e535f000fd7b53dadf6726d5cd29ac34cc75f Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 23 Jul 2020 08:58:19 +0200 Subject: Add pybind11 2.5 source --- .../pybind11/tests/test_embed/external_module.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 3rdparty/pybind11/tests/test_embed/external_module.cpp (limited to '3rdparty/pybind11/tests/test_embed/external_module.cpp') diff --git a/3rdparty/pybind11/tests/test_embed/external_module.cpp b/3rdparty/pybind11/tests/test_embed/external_module.cpp new file mode 100644 index 00000000..e9a6058b --- /dev/null +++ b/3rdparty/pybind11/tests/test_embed/external_module.cpp @@ -0,0 +1,23 @@ +#include + +namespace py = pybind11; + +/* Simple test module/test class to check that the referenced internals data of external pybind11 + * modules aren't preserved over a finalize/initialize. + */ + +PYBIND11_MODULE(external_module, m) { + class A { + public: + A(int value) : v{value} {}; + int v; + }; + + py::class_(m, "A") + .def(py::init()) + .def_readwrite("value", &A::v); + + m.def("internals_at", []() { + return reinterpret_cast(&py::detail::get_internals()); + }); +} -- cgit v1.2.3