-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-43536: [Python] Do not use borrowed references APIs #43540
Conversation
|
General question: are the (or if the answer is that those APIs are not supported for older versions of CPython, adopting |
We could use the strong reference APIs in the non-free-threaded build as well. Adopting |
These changes add a lot of conditional code. Also, sometimes they are not necessary, if we are sure the container (list/dict) will not be mutated in another thread. |
Thanks @pitrou for the review! I updated the PR to add |
This is ready for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot @lysnikolaou . I will rebase and try to run more CI.
174a1ef
to
202de1a
Compare
@github-actions crossbow submit -g python -g wheel |
Revision: 202de1a Submitted crossbow builds: ursacomputing/crossbow @ actions-ceaf2f2afb |
CI failures look unrelated, I'll merge. |
After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 894f72f. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 6 possible false positives for unstable benchmarks that are known to sometimes produce them. |
### Rationale for this change #43540 already vendored `pythoncapi_compat.h`, so closing #43069 by using this as well for `Py_IsFinalizing` (which was added in #42034, and for which we opened that follow-up issue to use `pythoncapi_compat.h` instead) Authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
Rationale for this change
For better reference safety under Python free-threaded builds (i.e. with the GIL removed), we should be using
Py(List|Dict)_GetItemRef
that return strong references and are implemented in a thread-safe manner.What changes are included in this PR?
Are these changes tested?
I ran the tests with the free-threaded build before and after, and there's the same expected failures.