Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitlab/scripts/prune-unsupported-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ set -euo pipefail
#
# TODO(py-315): cp315 wheels are built by "build linux" and "build linux serverless" under
# allow_failure so that 3.15 keeps producing CI signal, but they are compiled against the
# 3.15.0b1 PyThreadState layout and are ABI-broken. Drop cp315 from this list once #19861
# makes those wheels correct and 3.15 is a supported target.
# 3.15.0b1 PyThreadState layout and are ABI-broken. #19861 does not fix that ABI; it only
# makes cp315 optional in the package validator. Drop cp315 from this list after IMAGE_TAG
# is on images that can build a correct wheel, and only once 3.15 is a supported target.
UNSUPPORTED_TAGS=("cp315")

if [ "$#" -eq 0 ]; then
Expand Down
7 changes: 7 additions & 0 deletions .gitlab/templates/build-base-venvs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ build_base_venvs:
python scripts/allow_prerelease_dependencies.py
export PIP_PRE=true
fi
# PIP_IGNORE_REQUIRES_PYTHON lets riot's `pip install -e .` install the
# dev package despite requires-python = ">=3.9,<3.15". 3.15 only: other
# matrix versions already satisfy the bound.
# TODO(py-315): drop this once requires-python includes 3.15
case "$PYTHON_VERSION" in
3.15) export PIP_IGNORE_REQUIRES_PYTHON=1 ;;
esac
riot -P -v generate --python=$PYTHON_VERSION
.riot/venv_py3*/bin/pip freeze
echo "Running smoke tests"
Expand Down
4 changes: 2 additions & 2 deletions .gitlab/templates/cached-testrunner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
fi

source $EXT_CACHE_VENV/bin/activate
# Cython 3.3.0's cp315 wheel SIGSEGVs on pre-rc1 3.15. The pyproject.toml
# [build-system] pin (#19861) does not apply to this EXT_CACHE_VENV install.
# Cython 3.3 cp315 wheels SIGSEGV on pre-rc1 3.15; pyproject.toml pin does not apply here.
# TODO(py-315): drop this pin once testrunner 3.15 is 3.15.0rc1+.
if [ "$PYTHON_VERSION" = "3.15" ]; then
python -m pip install cmake setuptools_rust 'Cython<3.3'
else
Expand Down
2 changes: 1 addition & 1 deletion hooks/pre-commit/05-run-bandit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
LINT_CMD="${LINT_CMD:-scripts/lint}"
staged_files=$(git diff --staged --name-only HEAD --diff-filter=ACMR | grep -E '\.py$' | grep -v '^tests/' | grep -v '^lib-injection/' | tr '\n' ' ')
staged_files=$(git diff --staged --name-only HEAD --diff-filter=ACMR | grep -E '\.py$' | grep -v '^tests/' | tr '\n' ' ')
if [ -n "$staged_files" ]; then
file_count=$(echo "$staged_files" | wc -w | tr -d ' ')
echo "Running security scan on $file_count staged Python file(s)..."
Expand Down
2 changes: 1 addition & 1 deletion hooks/scripts/run-mypy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
LINT_CMD="${LINT_CMD:-scripts/lint}"
staged_files=$(git diff --staged --name-only HEAD --diff-filter=ACMR | grep -E '\.(py|pyi)$' | grep -v '^lib-injection/' | tr '\n' ' ')
staged_files=$(git diff --staged --name-only HEAD --diff-filter=ACMR | grep -E '\.(py|pyi)$' | tr '\n' ' ')
if [ -n "$staged_files" ]; then
# Drop .pyi stubs whose .py counterpart is also staged to avoid mypy
# "Duplicate module named ..." errors. mypy discovers stubs automatically.
Expand Down
14 changes: 5 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
[build-system]
requires = [
# Cython 3.3.0 is the first stable release to publish compiled cp315 wheels,
# and its cp315 manylinux wheel is compiled against the 3.15.0rc1 PyThreadState
# layout, which grew a member in 3.15.0b4 (python/cpython#151614). Our
# manylinux2014 images still ship 3.15.0b1, so that wheel segfaults the moment
# setup.py imports Cython.Build. <3.3 has no cp315-tagged wheel, so on these
# images 3.15 resolves the pure-Python cython-*-py3-none-any.whl instead, which
# has no ABI to mismatch. Drop this once the image mirror ships a cp315
# interpreter >= 3.15.0rc1; pypa manylinux 2026.08.04-1 is the first such tag.
# Cython 3.3 cp315 manylinux wheels SIGSEGV on the current 3.15 interpreter; <3.3 pins 3.2.x.
# TODO(py-315): drop this pin once IMAGE_TAG is on the 2026.08.04-1 images.
"cython<3.3; python_version >= '3.15'",
"cython; python_version < '3.15'",
"cmake>=3.24.2,<3.28",
Expand Down Expand Up @@ -135,7 +129,9 @@ lint = [
"cmake-format==0.6.13",
"ruamel.yaml==0.18.6",
"ast-grep-cli==0.39.4",
"bytecode==0.18.1; python_version >= '3.15'",
# Lint extra; 0.19.0 matches the runtime lower bound so uv can resolve
# both extras when requires-python includes 3.15.
"bytecode==0.19.0; python_version >= '3.15'",
"bytecode==0.17.0; python_version < '3.15'",
]
clean = [
Expand Down
38 changes: 4 additions & 34 deletions tests/internal/test_py315_import_degrade.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""Python 3.15 import-time degrade: wrapping must load, wrap() still raises.
"""Python 3.15 import-time degrade: wrapping must load.

Until #17849 lands bytecode wrapping for 3.15, products that import wrapping
(e.g. ModuleWatchdog) must not crash the process. wrap()/inject_hook still
raise NotImplementedError when actually used.
Products that import wrapping (e.g. ModuleWatchdog) must not crash the process.
Monitoring ``inject_hook`` already works on 3.15; this module does not assert
that wrap() raises. Wrap lift is a later PR.
"""

import re

import pytest

from ddtrace.internal.compat import NEXT_PY_UNSUPPORTED_MSG
Expand All @@ -31,20 +29,6 @@ def test_wrapping_modules_import():
import ddtrace.internal.wrapping.generators # noqa: F401


@pytest.mark.skipif(PYTHON_VERSION_INFO < NEXT_PY_VERSION_INFO, reason=f"{NEXT_PY_VERSION} wrap() degrade")
def test_wrap_raises_not_implemented_on_315():
from ddtrace.internal.wrapping import wrap

def f() -> None:
return None

def wrapper(wrapped, args, kwargs): # noqa: ANN001, ANN202
return wrapped(*args, **kwargs)

with pytest.raises(NotImplementedError, match=re.escape(_UNSUPPORTED_MSG)):
wrap(f, wrapper)


@pytest.mark.skipif(PYTHON_VERSION_INFO < NEXT_PY_VERSION_INFO, reason=f"{NEXT_PY_VERSION} lazy module degrade")
def test_lazy_module_decorator_without_bytecode_wrap():
import tests.internal.lazy as lazy_module
Expand Down Expand Up @@ -75,17 +59,3 @@ def test_debugging_products_load_without_failure():
"live-debugger",
):
assert product_name not in product_manager._failed


@pytest.mark.skipif(PYTHON_VERSION_INFO < NEXT_PY_VERSION_INFO, reason=f"{NEXT_PY_VERSION} inject_hook degrade")
def test_inject_hook_raises_not_implemented_on_315():
from ddtrace.internal.bytecode_injection import inject_hook

def f() -> None:
return None

def hook(_arg: object) -> None:
return None

with pytest.raises(NotImplementedError, match=re.escape(_UNSUPPORTED_MSG)):
inject_hook(f, hook, f.__code__.co_firstlineno, None)
Loading