2018-01-11 23:46:10 +00:00
|
|
|
#include <pybind11/pybind11.h>
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2024-06-18 20:54:38 +00:00
|
|
|
PYBIND11_MODULE(external_module, m, py::mod_gil_not_used()) {
|
2018-01-11 23:46:10 +00:00
|
|
|
class A {
|
|
|
|
public:
|
CodeHealth: Enabling clang-tidy google-explicit-constructor (#3250)
* Adding google-explicit-constructor to .clang-tidy
* clang-tidy explicit attr.h (all automatic)
* clang-tidy explicit cast.h (all automatic)
* clang-tidy detail/init.h (1 NOLINT)
* clang-tidy detail/type_caster_base.h (2 NOLINT)
* clang-tidy pybind11.h (7 NOLINT)
* clang-tidy detail/common.h (3 NOLINT)
* clang-tidy detail/descr.h (2 NOLINT)
* clang-tidy pytypes.h (23 NOLINT, only 1 explicit)
* clang-tidy eigen.h (7 NOLINT, 0 explicit)
* Adding 2 explicit in functional.h
* Adding 4 explicit in iostream.h
* clang-tidy numpy.h (1 NOLINT, 1 explicit)
* clang-tidy embed.h (0 NOLINT, 1 explicit)
* clang-tidy tests/local_bindings.h (0 NOLINT, 4 explicit)
* clang-tidy tests/pybind11_cross_module_tests.cpp (0 NOLINT, 1 explicit)
* clang-tidy tests/pybind11_tests.h (0 NOLINT, 2 explicit)
* clang-tidy tests/test_buffers.cpp (0 NOLINT, 2 explicit)
* clang-tidy tests/test_builtin_casters.cpp (0 NOLINT, 4 explicit)
* clang-tidy tests/test_class.cpp (0 NOLINT, 6 explicit)
* clang-tidy tests/test_copy_move.cpp (0 NOLINT, 7 explicit)
* clang-tidy tests/test_embed/external_module.cpp (0 NOLINT, 1 explicit)
* clang-tidy tests/test_embed/test_interpreter.cpp (0 NOLINT, 1 explicit)
* clang-tidy tests/object.h (0 NOLINT, 2 explicit)
* clang-tidy batch of fully automatic fixes.
* Workaround for MSVC 19.16.27045.0 C++17 Python 2 C++ syntax error.
2021-09-09 01:53:38 +00:00
|
|
|
explicit A(int value) : v{value} {};
|
2018-01-11 23:46:10 +00:00
|
|
|
int v;
|
|
|
|
};
|
|
|
|
|
2022-02-10 20:17:07 +00:00
|
|
|
py::class_<A>(m, "A").def(py::init<int>()).def_readwrite("value", &A::v);
|
2018-01-11 23:46:10 +00:00
|
|
|
|
2022-02-10 20:17:07 +00:00
|
|
|
m.def("internals_at",
|
|
|
|
[]() { return reinterpret_cast<uintptr_t>(&py::detail::get_internals()); });
|
2018-01-11 23:46:10 +00:00
|
|
|
}
|