tests: always disable on the nogil build (#5701)

* docs: fix docs on visibilty preset hidden

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: always disable on the nogil build

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* docs: mention skip reason in comment

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Henry Schreiner
2025-05-28 23:33:53 -04:00
committed by GitHub
parent 57e27c1ffc
commit a18b1bc4dc
2 changed files with 6 additions and 2 deletions

View File

@@ -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",
)

View File

@@ -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