Skip to content
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

use FFI calls for refcounting on all abi3 versions #4324

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

davidhewitt
Copy link
Member

As per #4311 (comment)

The idea is that we can mitigate issues around 3.12's immortal objects and wonky CPython assertions by backporting the stable ABI change to use FFI calls for refcounting from 3.12 all the way back to our supported version of 3.8.

cc @alex - you might be interested in this for the possible performance impact on cryptography (though this impact would be felt eventually anyway).

@alex
Copy link
Contributor

alex commented Jul 9, 2024

Our benchmarking infra isn't particularly high fidelity, but this change looks like it's within the noise floor for us: https://github.com/pyca/cryptography/actions/runs/9856363207?pr=11232

@davidhewitt
Copy link
Member Author

👍

cc @mgorny are you willing to test one of the problematic packages with this branch? If so, I'm tempted to merge it for the simplification it brings.

@mgorny
Copy link

mgorny commented Jul 9, 2024

I'll try on rustworkx in a minute.

@mgorny
Copy link

mgorny commented Jul 9, 2024

And confirmed! Without the patch, rustworkx crashes; with the patch, it passes all tests.

@davidhewitt
Copy link
Member Author

Great! In which case if fellow PyO3 maintainers are happy, I propose to merge this and ship as 0.22.2 (maybe also with #4321 when that's done).

@davidhewitt
Copy link
Member Author

Thanks @mgorny and @alex for testing!

@davidhewitt davidhewitt mentioned this pull request Jul 10, 2024
@davidhewitt
Copy link
Member Author

Having heard no concerns, I think let's move ahead with this.

@davidhewitt davidhewitt added this pull request to the merge queue Jul 12, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 12, 2024
@davidhewitt davidhewitt added this pull request to the merge queue Jul 12, 2024
Merged via the queue into PyO3:main with commit 397e6d8 Jul 12, 2024
81 of 82 checks passed
@davidhewitt davidhewitt deleted the stable-abi-refcounting branch July 12, 2024 17:04
@davidhewitt
Copy link
Member Author

cc @encukou @vstinner - with this patch PyO3 is using Py_IncRef or _Py_IncRef (and similar for decref) for all stable ABI versions.

davidhewitt added a commit that referenced this pull request Jul 16, 2024
* use FFI calls for refcounting on all abi3 versions

* fix implementation on PyPy
davidhewitt added a commit that referenced this pull request Jul 16, 2024
* use FFI calls for refcounting on all abi3 versions

* fix implementation on PyPy
davidhewitt added a commit that referenced this pull request Jul 17, 2024
* use FFI calls for refcounting on all abi3 versions

* fix implementation on PyPy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants