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
diff --git a/tests/test_gil_scoped.py b/tests/test_gil_scoped.py
index 2c72fc6..1548337 100644
--- a/tests/test_gil_scoped.py
+++ b/tests/test_gil_scoped.py
@@ -78,3 +78,8 @@
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