Files
pybind11/tests/env.py
Ralf W. Grosse-Kunstleve b30e72c6f6 Replace env.deprecated_call() with pytest.deprecated_call() (#5893)
Since we already require pytest>=6 (see tests/requirements.txt), the
old compatibility function is obsolete and pytest.deprecated_call() can
be used directly.

Extracted from PR #5879

Co-authored-by: Michael Carlstrom <rmc@carlstrom.com>
Co-authored-by: gentlegiantJGC <gentlegiantJGC@users.noreply.github.com>
2025-11-11 19:27:53 -08:00

30 lines
997 B
Python

from __future__ import annotations
import platform
import sys
import sysconfig
ANDROID = sys.platform.startswith("android")
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"
GRAALPY = sys.implementation.name == "graalpy"
_graalpy_version = (
sys.modules["__graalpython__"].get_graalvm_version() if GRAALPY else "0.0.0"
)
GRAALPY_VERSION = tuple(int(t) for t in _graalpy_version.split("-")[0].split(".")[:3])
# Compile-time config (what the binary was built for)
PY_GIL_DISABLED = bool(sysconfig.get_config_var("Py_GIL_DISABLED"))
# Runtime state (what's actually happening now)
sys_is_gil_enabled = getattr(sys, "_is_gil_enabled", lambda: True)
TYPES_ARE_IMMORTAL = (
PYPY
or GRAALPY
or (CPYTHON and PY_GIL_DISABLED and (3, 13) <= sys.version_info < (3, 14))
)