mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
baa540ec34
* Support free-threaded CPython (PEP 703) Some additional locking is added in the free-threaded build when `Py_GIL_DISABLED` is defined: - Most accesses to internals are protected by a single mutex - The registered_instances uses a striped lock to improve concurrency Pybind11 modules can indicate support for running with the GIL disabled by calling `set_gil_not_used()`. * refactor: use PYBIND11_MODULE (#11) Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * Address code review * Suppress MSVC warning * Changes from review * style: pre-commit fixes * `py::mod_gil_not_used()` suggestion. * Update include/pybind11/pybind11.h --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
30 lines
1011 B
Python
30 lines
1011 B
Python
import platform
|
|
import sys
|
|
import sysconfig
|
|
|
|
import pytest
|
|
|
|
LINUX = sys.platform.startswith("linux")
|
|
MACOS = sys.platform.startswith("darwin")
|
|
WIN = sys.platform.startswith("win32") or sys.platform.startswith("cygwin")
|
|
|
|
CPYTHON = platform.python_implementation() == "CPython"
|
|
PYPY = platform.python_implementation() == "PyPy"
|
|
PY_GIL_DISABLED = bool(sysconfig.get_config_var("Py_GIL_DISABLED"))
|
|
|
|
|
|
def deprecated_call():
|
|
"""
|
|
pytest.deprecated_call() seems broken in pytest<3.9.x; concretely, it
|
|
doesn't work on CPython 3.8.0 with pytest==3.3.2 on Ubuntu 18.04 (#2922).
|
|
|
|
This is a narrowed reimplementation of the following PR :(
|
|
https://github.com/pytest-dev/pytest/pull/4104
|
|
"""
|
|
# TODO: Remove this when testing requires pytest>=3.9.
|
|
pieces = pytest.__version__.split(".")
|
|
pytest_major_minor = (int(pieces[0]), int(pieces[1]))
|
|
if pytest_major_minor < (3, 9):
|
|
return pytest.warns((DeprecationWarning, PendingDeprecationWarning))
|
|
return pytest.deprecated_call()
|