diff --git a/tests/test_gil_scoped.py b/tests/test_gil_scoped.py index d7efc9af6..04f7b09c7 100644 --- a/tests/test_gil_scoped.py +++ b/tests/test_gil_scoped.py @@ -2,6 +2,7 @@ from __future__ import annotations import multiprocessing import sys +import sysconfig import threading import time @@ -10,8 +11,11 @@ import pytest import env from pybind11_tests import gil_scoped as m +# Test collection seems to hold the gil +# These tests have rare flakes in nogil; since they +# are testing the gil, they are skipped at the moment. skipif_not_free_threaded = pytest.mark.skipif( - not getattr(sys, "_is_gil_enabled", lambda: True)(), + sysconfig.get_config_var("Py_GIL_DISABLED"), reason="Flaky without the GIL", ) diff --git a/tools/pybind11Config.cmake.in b/tools/pybind11Config.cmake.in index fac112ecb..f52b2fb89 100644 --- a/tools/pybind11Config.cmake.in +++ b/tools/pybind11Config.cmake.in @@ -94,7 +94,7 @@ you can either use the basic targets, or use the FindPython tools: target_link_libraries(MyModule2 PUBLIC pybind11::headers) set_target_properties(MyModule2 PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON - CXX_VISIBILITY_PRESET ON + CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON) If you build targets yourself, you may be interested in stripping the output