continue to use PyEval_GetBuiltins for PyPy

This commit is contained in:
Wenzel Jakob 2022-11-02 15:44:19 +01:00
parent f4e6c7833e
commit cc03a56512
2 changed files with 2 additions and 2 deletions

View File

@ -423,7 +423,7 @@ PYBIND11_NOINLINE internals &get_internals() {
str id(id_cstr); str id(id_cstr);
dict state_dict; dict state_dict;
#if PY_VERSION_HEX < 0x03080000 #if PY_VERSION_HEX < 0x03080000 || defined(PYPY_VERSION)
state_dict = reinterpret_borrow<dict>(PyEval_GetBuiltins()); state_dict = reinterpret_borrow<dict>(PyEval_GetBuiltins());
#elif PY_VERSION_HEX < 0x03090000 #elif PY_VERSION_HEX < 0x03090000
state_dict = reinterpret_borrow<dict>(PyInterpreterState_GetDict(_PyInterpreterState_Get())); state_dict = reinterpret_borrow<dict>(PyInterpreterState_GetDict(_PyInterpreterState_Get()));

View File

@ -170,7 +170,7 @@ TEST_CASE("There can be only one interpreter") {
bool has_pybind11_internals_builtin() { bool has_pybind11_internals_builtin() {
py::dict state_dict; py::dict state_dict;
#if PY_VERSION_HEX < 0x03080000 #if PY_VERSION_HEX < 0x03080000 || defined(PYPY_VERSION)
state_dict = py::reinterpret_borrow<py::dict>(PyEval_GetBuiltins()); state_dict = py::reinterpret_borrow<py::dict>(PyEval_GetBuiltins());
#elif PY_VERSION_HEX < 0x03090000 #elif PY_VERSION_HEX < 0x03090000
state_dict state_dict