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

@@ -78,3 +78,8 @@ def test_python_to_cpp_to_python_from_process():
This test is for completion, but it was never an issue.
"""
assert _run_in_process(_python_to_cpp_to_python) == 0
def test_cross_module_gil():
"""Makes sure that the GIL can be acquired by another module from a GIL-released state."""
m.test_cross_module_gil() # Should not raise a SIGSEGV