-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
gh-133143: Make information about the interpreter ABI more accessible #137476
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
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
d572a62
to
8890dc5
Compare
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.
This is a big PR!
I'll ask you to simplify (and, alas, throw a lot of the scaffolding work away...)
ab093fc
to
defb2b2
Compare
Thanks for your review, @encukou! I think I have addressed all of your comments and, as you anticipated, it simplifies things a great deal. Would you mind taking another look? |
Looks good now, thanks! And, of course, it needs deciding on what should go here; but that's for the discussion thread. |
Agreed about the tests and further discussion. I just wanted to stabilize the implementation sufficiently to be sure to write meaningful tests. Thanks again! |
Tests are in place and easily extendable. Let's focus on the discussion and get this in 💪. |
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.
Can you also mention the new sys.abi_info in Doc/whatsnew/3.15.rst document? You should add a new "sys" section in https://docs.python.org/dev/whatsnew/3.15.html#improved-modules
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
With the latest addition of comments on the Windows side of things, I think I addressed all comments. @AA-Turner apologies again for the rebase snafu. I hope a review is still doable. |
🤖 New build scheduled with the buildbot fleet by @encukou for commit ed7b6d9 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F137476%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Could you add semantic Sphinx syntax for With that, I consider this good to merge :) |
sys.abi_info: Use Sphinx markup for attributes
Done, thanks! |
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
oops, I meant to push to my own branch to propose a PR to @zklaus's repo, sorry. Given Petr has enabled auto-merge already I'll propose my changes in a follow-up. Separately, should we use a named type for ❯ .\python.bat
>>> import sys
>>> sys.abi_info
namespace(pointer_bits=64, free_threaded=False, debug=True, byteorder='little') A |
I don't think that using namespace is a big deal here. |
Congrats @zklaus, your PR was merged :-) |
|
I realised that one drawback of using A |
No need. This is Python; consenting adults; you break it you get to keep the pieces; etc. You can already set |
The available entries are the same on all platforms; | ||
e.g. *pointer_size* is available even on 64-bit-only architectures. |
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.
e.g. would have been better spelled out as for example
This makes information about the interpreter ABI more accessible. Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This adds a new
sys.abi_info
object to make basic abi information more readily accessible.The basic idea is to have not just flags as originally envisioned in #133143, but rather a more pythonic object with the required information, following the model of the
sys.thread_info
andsys.int_info
object as suggested in the discussion by @encukou.gh-133143
📚 Documentation preview 📚: https://cpython-previews--137476.org.readthedocs.build/