Skip to content

bpo-35348: platform.architecture() doc suggests sys.maxsize #11208

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion Doc/library/platform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ Cross Platform
and then only if the executable points to the Python interpreter. Reasonable
defaults are used when the above needs are not met.

To only get the pointer size of the running Python interpreter,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.maxsize gives you the size of Py_ssize_t. On most platforms this is the same as the pointer size, but it is not guaranteed.

But I do not think that this addition is needed. platform.architecture() without arguments give you the bittness of the running Python interpreter. It does not try to guess it by parsing the file output.

:attr:`sys.maxsize` or ``struct.calcsize('P')`` can be used.

.. note::

On Mac OS X (and perhaps other platforms), executable files may be
On macOS (and perhaps other platforms), executable files can be
universal files containing multiple architectures.

To get at the "64-bitness" of the current interpreter, it is more
Expand Down