chore(compat): MAX_PY=3.14 last-supported, wrap fail-closes at 3.16 (PROF-14439) - #19928
chore(compat): MAX_PY=3.14 last-supported, wrap fail-closes at 3.16 (PROF-14439)#19928vlad-scherbich wants to merge 21 commits into
Conversation
Circular import analysis
|
Dependency direction analysis
|
Codeowners resolved asResolved from the full PR diff against |
dff1fad to
1d382ed
Compare
9be2db6 to
b142960
Compare
BenchmarksBenchmark execution time: 2026-09-02 20:47:37 Comparing candidate commit 5b7eaa7 in PR branch Found 0 performance improvements and 7 performance regressions! Performance is the same for 575 metrics, 10 unstable metrics, 2 known flaky benchmarks, 16 flaky benchmarks without significant changes.
|
cc2e9df to
f7e0135
Compare
b142960 to
a2f5c63
Compare
f7e0135 to
bd4659f
Compare
a2f5c63 to
3f0ff70
Compare
|
bd4659f to
39cfe79
Compare
3f0ff70 to
c8b4968
Compare
There was a problem hiding this comment.
Pull request overview
This PR standardizes Python version bound constants in ddtrace.internal.compat by introducing MAX_PY_VERSION / NEXT_MAX_PY_VERSION and derived predicates (PY_GTE_MAX, PY_GTE_NEXT_MAX), then updates internal call sites and tests to use these shared checks (including wrapping fail-closed behavior and injection runtime allow-listing).
Changes:
- Add MAX/NEXT_MAX version constants + predicates to
ddtrace.internal.compat. - Replace ad-hoc version comparisons with shared predicates in wrapping-related code paths and tests.
- Align injection bootstrap runtime allow-list upper bound with
NEXT_MAX_PY_VERSION_INFO.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
ddtrace/internal/compat.py |
Adds MAX/NEXT_MAX constants and PY_GTE_* predicates (with updated exports). |
ddtrace/internal/wrapping/__init__.py |
Switches wrap/wrap_bytecode fail-closed gate to PY_GTE_MAX. |
ddtrace/internal/wrapping/context.py |
Switches the 3.16+ fail-closed import-time gate to PY_GTE_NEXT_MAX. |
ddtrace/internal/module.py |
Updates lazy-module behavior gating to PY_GTE_MAX. |
ddtrace/internal/monitoring.py |
Replaces 3.15+ import guard with a MAX-based guard/message. |
ddtrace/internal/coverage/instrumentation_py3_12.py |
Replaces hardcoded 3.15 boundaries with MAX_PY_VERSION_INFO for PEP 810-related behavior. |
lib-injection/sources/sitecustomize.py |
Sets injection runtime exclusive upper bound to (3, 16) via NEXT_MAX_PY_VERSION_INFO. |
tests/internal/test_py315_import_degrade.py |
Adds assertions for the new constants/predicates and updates skipifs to use PY_GTE_MAX. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
491eee9 to
ccb4174
Compare
ee96ec3 to
cd21a98
Compare
72d581d to
193b489
Compare
8d6df69 to
f14152f
Compare
193b489 to
aedc687
Compare
f14152f to
38e7bef
Compare
…imited-API PyContextVar_New/_Get/_Set are absent from pyo3-ffi limited-API bindings. PyGILState_Check is not limited-API; on those builds skip the probe rather than acquire or guess from a crash signal handler.
rust-ci runs clippy -D warnings; rustdoc does not document extern blocks, so the /// notes were unused_doc_comments.
Wheel smoke tests fail on 3.15 because wrapping raises at import and profiling.auto loads native extensions that are not built yet. Defer the wrapping error until wrap is actually used, and disable the profiler when those extensions are missing.
Part of the #17849 split (PR 6/6).
Address Copilot review on PR #19267: eject_all_hooks is intentionally a no-op compatibility stub (injection disabled on NEXT_PY_VERSION_INFO+), and _first_instr_line docstring uses plain text consistent with the module.
Restore blank line after local import removed during rebase conflict resolution.
starts_line became a bool in 3.13, not 3.15, so main's existing 3.14+ branch already covers 3.15. The unified helper also changed targeting on 3.11-3.13 by skipping co_firstlineno. Restore the version-split implementation and use plain-text comments in logging/patch.py.
Iterate snapshot wrapping contexts by value so restore_all has no unused name.
Keep the list() snapshots; the named annotated temps were not part of the 3.15 delta.
logging.__version__ is deprecated on 3.15+ with no replacement API. Match stdlib integrations (unittest, subprocess, urllib) instead of silencing the warning.
List 3.15 in SUPPORTED_PYTHON_VERSIONS so select_pys can opt in. Default MAX stays 3.14. Smoke and sourcecode opt in.
check_requirements_lockfiles prunes hashes riot list does not emit. Keep smoke_test (b388a93) and sourcecode (c2ce19f) only.
Rename support bounds to MAX_PY / NEXT_MAX_PY. Pin PY_315_VERSION_INFO for 3.15-only APIs. wrap() and lazy stay live on 3.15 and fail closed from 3.16, not NEXT_MAX_PY. requires-python stays <3.15.
aedc687 to
fa975ec
Compare
38e7bef to
5b7eaa7
Compare
Description
Delta vs #19906.
MAX_PYis (3, 14) — last officially supported, matchingrequires-python <3.15.NEXT_MAX_PYis (3, 15). wrap/lazy stay live on 3.15 and fail-close at 3.16, not atNEXT_MAX_PY.PY_315_VERSION_INFOis the CPython API floor and is not aliased toMAX_PY.This PR does not widen
requires-python.Testing
Constants pin MAX_PY=(3, 14), NEXT_MAX_PY=(3, 15), PY_315=(3, 15). wrap() monkeypatch pins fail-close at 3.16.
Risks
None.
Additional Notes
Official do-not-merge line is #19995 ← #19996.
No release note: internal constants,
changelog/no-changelog.