-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Remove cross-version binary compatibility #76569
Comments
See original discussion on python-dev: Summary: binary compatibility for C extensions which don't use the stable ABI is currently "best effort" and uses distinguished flags in the tp_flags field of type objects to indicate whether a field is physically present or not. Unfortunately, tp_flags is 32 bits and therefore a scarce resource. Also, binary compatibility is 1) not guaranteed anyway 2) of less use nowadays. So we propose to remove the binary compatibility requirement when creating static type objects (i.e. not using the stable ABI). |
Totally okay with this in theory, but wanted to clarify that the linked PR is really just taking advantage of removing the guarantee? That is, the change isn't necessary to remove the requirement. |
That's basically exact. Actually, there is no ABI guarantee at all (when not using the stable ABI), just a best effort for advanced users who know what they're doing. Actually, this PR stems from Nathaniel's message here: |
Good to know. As I said on the other issue, Windows won't load extension modules built for a different version anyway unless they use the stable ABI, so there's no real reason these flags need to be binary compatible between 3.x versions. |
I'm ok with "removing" this "guarantee" (although it seems too late to apply this specific change to 3.7 now). While Cython users do ask for a way to build cross-version binaries from time to time, it's neither supported nor planned, and the underlying problem is IMHO solved better via tooling like the manylinux wheel build. I also generally consider it good to let user code take advantage of new features in new CPython releases, even if it means that they need to retranslate their Cython code from time to time. The 1.5 years release cycle of CPython should exceed that of most "still in maintenance" extension modules out there, and it's long enough to not impose a real burden on their maintainers. |
Yes, let's retarget to 3.8. |
In which version of Python tp_finalize slot has been added? Does it mean that Python 3.8 wil crash on loading C extensions compiled on Python older than this version? |
What makes you think that it would be otherwise be able to load and execute such C extensions without any bugs? There is no ABI except the stable ABI, and tp_flags isn't part of the stable ABI. PS : tp_finalize is in Python 3.4, but that doesn't really matter. |
I updated the PR (sorry to let this sleep). |
PR is merged now! |
About ABI "foward compatibility", Python 3.8 introduced another backward incompatible change: bpo-37250 "C files generated by Cython set tp_print to NULL: PyTypeObject.tp_print removed, replaced with tp_vectorcall_offset". |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: