Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2e3e54a
Add sys.abi_info
zklaus Aug 1, 2025
2ddafa4
📜🤖 Added by blurb_it.
blurb-it[bot] Aug 6, 2025
cdc50c3
Simplify pointer_bits handling
zklaus Aug 7, 2025
6fb25a3
Remove explicit C API function
zklaus Aug 7, 2025
4c3d83d
Make abi_info object a simple namespace with no explicit C API
zklaus Aug 7, 2025
820e002
Cleanup scaffolding
zklaus Aug 7, 2025
918521f
Fix make_abi_info to be static
zklaus Aug 7, 2025
7863651
Add test
zklaus Aug 12, 2025
81d75fc
Fix test
zklaus Aug 12, 2025
41027a3
Add link
zklaus Aug 14, 2025
56726ab
Rename attributes
zklaus Aug 14, 2025
94b7f40
Add better attribute specification to docs
zklaus Aug 21, 2025
6887d6c
Base `debug` on Py_REF_DEBUG
zklaus Aug 21, 2025
7ced683
Add byteorder
zklaus Aug 21, 2025
cc5ae8c
Fix test
zklaus Aug 21, 2025
5c18587
Improve error message in test
zklaus Aug 21, 2025
d025d17
Apply suggestions from code review
zklaus Sep 2, 2025
a089371
Revert "Base `debug` on Py_REF_DEBUG"
zklaus Sep 2, 2025
44ce7c7
Add whatsnew entry for improved sys module
zklaus Sep 2, 2025
8f57f17
Update Python/sysmodule.c
zklaus Sep 3, 2025
77f7b9b
Integrate suggestions from Adam Turner
zklaus Sep 3, 2025
312bff1
Add Windows configuration equivalents
zklaus Sep 4, 2025
ed7b6d9
Fix rst lint
zklaus Sep 4, 2025
15f065a
Use Sphinx markup for attributes
encukou Sep 5, 2025
151eb4c
Merge pull request #3 from encukou/add-sys.abi_info
zklaus Sep 8, 2025
9f5ffae
Merge branch 'main' into add-sys.abi_info
AA-Turner Sep 8, 2025
128b150
Don't use ReST in a C comment
encukou Sep 8, 2025
0506533
docs rephrasing
AA-Turner Sep 8, 2025
c0fcade
Condense the implementation
AA-Turner Sep 8, 2025
87f02ef
Merge branch 'main' into add-sys.abi_info
AA-Turner Sep 8, 2025
8dfbdee
Petr's review
AA-Turner Sep 8, 2025
9547274
Ben's review
AA-Turner Sep 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Integrate suggestions from Adam Turner
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
  • Loading branch information
zklaus and AA-Turner committed Sep 3, 2025
commit 77f7b9bd6d8390ab51e6eedc3880c96df03f2952
35 changes: 17 additions & 18 deletions Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,34 @@ always available. Unless explicitly noted otherwise, all variables are read-only

.. data:: abi_info

.. versionadded:: next

An object containing information about the ABI of the currently running
Python interpreter.
It should include information that affect the CPython ABI in ways that require
a specific build of the interpreter chosen from variants that can co-exist on
a single machine. For example, it does not encode the base OS (Linux or
Windows), but does include pointer size since some systems support both 32-
and 64- builds. The available entries are the same on all platforms; e.g.
pointer_size is available even on 64-bit-only architectures.

New entries should be added when needed for a supported platform, or (for
enabling an unsupported one) by core dev consensus. Entries should be removed
following :pep:`387`.
It should include information that affect the CPython ABI in ways that
require a specific build of the interpreter chosen from variants that can
co-exist on a single machine.
For example, it does not encode the base OS (Linux or Windows), but does
include pointer size since some systems support both 32- and 64-bit builds.
The available entries are the same on all platforms;
e.g. *pointer_size* is available even on 64-bit-only architectures.

The following attributes are available in CPython:
The following attributes are available:

*pointer_bits* is the width of pointers in bits, as an integer, equivalent
to ``8 * sizeof(void *)``, i.e. usually ``32`` or ``64``.

*free_threaded* is a boolean indicating whether the interpreter was built
with the GIL disabled, i.e. with the :option:`--disable-gil` option,
aka free-threading.
*free_threaded* is a boolean indicating whether the interpreter supports
running in free-threaded mode (i.e. with the GIL disabled).
This reflects the presence of the :option:`--disable-gil` configure option.

*debug* is a boolean indicating whether the interpreter was built in
:ref:`debug mode <debug-build>`, i.e. with the :option:`--with-pydebug` option.
:ref:`debug mode <debug-build>`.
This reflects the presence of the :option:`--with-pydebug` configure option.

*byteorder* is a string indicating the native byte order, either ``'big'`` or
``'little'``. This is the same as the :data:`byteorder` attribute.

.. versionadded:: next
``'little'``.
This is the same as the :data:`sys.byteorder` attribute.


.. data:: abiflags
Expand Down
3 changes: 3 additions & 0 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3643,6 +3643,9 @@ make_impl_info(PyObject *version_info)
static PyObject *
make_abi_info(void)
{
// New entries should be added when needed for a supported platform, or (for
// enabling an unsupported one) by core dev consensus. Entries should be removed
// following :pep:`387`.
int res;
PyObject *abi_info, *value, *ns;
abi_info = PyDict_New();
Expand Down