Make sure detail::get_internals acquires the GIL before making Python calls. (#1836)

This is only necessary if `get_internals` is called for the first time in a given module when the running thread is in a GIL-released state.

Fixes #1364
This commit is contained in:
Saran Tunyasuvunakool
2019-07-15 15:47:02 +01:00
committed by Wenzel Jakob
parent dffe869dba
commit b60fd233fa
5 changed files with 106 additions and 0 deletions

View File

@@ -83,6 +83,10 @@ set(PYBIND11_CROSS_MODULE_TESTS
test_stl_binders.py
)
set(PYBIND11_CROSS_MODULE_GIL_TESTS
test_gil_scoped.py
)
# Check if Eigen is available; if not, remove from PYBIND11_TEST_FILES (but
# keep it in PYBIND11_PYTEST_FILES, so that we get the "eigen is not installed"
# skip message).
@@ -150,6 +154,14 @@ foreach(t ${PYBIND11_CROSS_MODULE_TESTS})
endif()
endforeach()
foreach(t ${PYBIND11_CROSS_MODULE_GIL_TESTS})
list(FIND PYBIND11_PYTEST_FILES ${t} i)
if (i GREATER -1)
list(APPEND test_targets cross_module_gil_utils)
break()
endif()
endforeach()
set(testdir ${CMAKE_CURRENT_SOURCE_DIR})
foreach(target ${test_targets})
set(test_files ${PYBIND11_TEST_FILES})