chore(native): declare PyContextVar_* locally for limited-API builds (PROF-15850) - #19903
Conversation
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 26f0728 | Docs | View more details | Give us feedback! |
BenchmarksBenchmark execution time: 2026-09-02 20:42:03 Comparing candidate commit 26f0728 in PR branch Found 0 performance improvements and 6 performance regressions! Performance is the same for 576 metrics, 10 unstable metrics, 2 known flaky benchmarks, 16 flaky benchmarks without significant changes.
|
|
Part of #19908 |
There was a problem hiding this comment.
Pull request overview
This PR fixes Rust native extension builds under Py_LIMITED_API (e.g., CPython 3.15 builds using PYO3_USE_ABI3_FORWARD_COMPATIBILITY) by locally declaring the PyContextVar_New, PyContextVar_Get, and PyContextVar_Set C-API entry points that are not exposed by pyo3-ffi in that configuration.
Changes:
- Add local
extern "C"declarations forPyContextVar_*functions insrc/native/contextvar.rs. - Switch call sites from
ffi::PyContextVar_*to the locally declared symbols so the module compiles with and withoutPy_LIMITED_API.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
5e2e905 to
9c1783d
Compare
Codeowners resolved asResolved from the full PR diff against No remaining files require a CODEOWNERS review. |
Circular import analysis
|
Dependency direction analysis
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e2e90539b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
f9ee924 to
12acbff
Compare
12acbff to
59047aa
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.
3260237 to
26f0728
Compare
|
/merge -m squash |
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
vlad.scherbich@datadoghq.com unqueued this merge request |
|
/remove |
|
View all feedbacks in Devflow UI.
|
|
/merge -f --reason "All checks besides unrelated pytorch failures passed multiple times. Unrelated to this change." |
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
vlad.scherbich@datadoghq.com unqueued this merge request |
|
/merge -f --reason "All checks besides unrelated pytorch failures passed multiple times. Unrelated to this change." |
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
devflow unqueued this merge request: It did not become mergeable within the expected time |
|
/code blockers |
|
View all feedbacks in Devflow UI.
Checking merge blockers for #19903...
Detected 1 merge blocker(s) to address: 🔴 Blocking
|
|
/code blockers |
|
View all feedbacks in Devflow UI.
Checking merge blockers for #19903...
No merge blockers detected. |
|
/merge -f --reason "This code change doesn't affect flaky CI jobs." |
|
View all feedbacks in Devflow UI.
The expected merge time in
Warning This change was merged without running any pre merge CI checks Reason: This code change doesn't affect flaky CI jobs. |
Description
Limited-API shims so native builds compile under
Py_LIMITED_API.src/native/contextvar.rsdeclaresPyContextVar_New/_Get/_Setlocally; pyo3-ffi omits them.src/native/crashtracker/crashtracker_runtime_stacks.rsskipsPyGILState_Checkon limited-API (not in the stable ABI;Ensureis not signal-safe).//instead of///on the extern block so rustc does not doctest it.Does not schedule 3.15 riot, widen
requires-python, or change wheel publish.Testing
Native crate compiles with the local declarations.
Risks
None.
Additional Notes
Base:
main. Unofficial next: #19267. Profiling next: #19269.No release note: internal FFI,
changelog/no-changelog.Contributes to #17817