mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
* fix: follow rest of pybind11 closer with PYBIND11_HAS_SUBINTERPRETER_SUPPORT Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * style: pre-commit fixes --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
18 lines
603 B
C++
18 lines
603 B
C++
#include <pybind11/pybind11.h>
|
|
|
|
namespace py = pybind11;
|
|
|
|
/* Simple test module/test class to check that the referenced internals data of external pybind11
|
|
* modules are different across subinterpreters
|
|
*/
|
|
|
|
PYBIND11_MODULE(mod_shared_interpreter_gil, m, py::multiple_interpreters::shared_gil()) {
|
|
m.def("internals_at",
|
|
[]() { return reinterpret_cast<uintptr_t>(&py::detail::get_internals()); });
|
|
#ifdef PYBIND11_HAS_SUBINTERPRETER_SUPPORT
|
|
m.attr("defined_PYBIND11_HAS_SUBINTERPRETER_SUPPORT") = true;
|
|
#else
|
|
m.attr("defined_PYBIND11_HAS_SUBINTERPRETER_SUPPORT") = false;
|
|
#endif
|
|
}
|