mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 14:45:12 +00:00
fix C++ test
This commit is contained in:
parent
daf768aeb7
commit
8df2e819d2
@ -169,8 +169,15 @@ TEST_CASE("There can be only one interpreter") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool has_pybind11_internals_builtin() {
|
bool has_pybind11_internals_builtin() {
|
||||||
auto builtins = py::handle(PyEval_GetBuiltins());
|
py::dict state_dict;
|
||||||
return builtins.contains(PYBIND11_INTERNALS_ID);
|
#if PY_VERSION_HEX < 0x03080000
|
||||||
|
state_dict = py::reinterpret_borrow<py::dict>(PyEval_GetBuiltins());
|
||||||
|
#elif PY_VERSION_HEX < 0x03090000
|
||||||
|
state_dict = py::reinterpret_borrow<py::dict>(PyInterpreterState_GetDict(_PyInterpreterState_Get()));
|
||||||
|
#else
|
||||||
|
state_dict = py::reinterpret_borrow<py::dict>(PyInterpreterState_GetDict(PyInterpreterState_Get()));
|
||||||
|
#endif
|
||||||
|
return state_dict.contains(PYBIND11_INTERNALS_ID);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool has_pybind11_internals_static() {
|
bool has_pybind11_internals_static() {
|
||||||
|
Loading…
Reference in New Issue
Block a user