Visitar URL original
gh-161870: Skip test_platform when a 32-bit build sees a different machine name by sainimal1ba-hue · Pull Request #161879 · python/cpython · GitHub
Skip to content

gh-161870: Skip test_platform when a 32-bit build sees a different machine name - #161879

Open
sainimal1ba-hue wants to merge 2 commits into
python:mainfrom
sainimal1ba-hue:gh-161870
Open

sainimal1ba-hue wants to merge 2 commits into
python:mainfrom
sainimal1ba-hue:gh-161870

Conversation

@sainimal1ba-hue

Copy link
Copy Markdown

Issue: gh-161870
build-details.json records sysconfig.get_platform() from the build machine, and test_platform compared that value with the one computed at test time. On Linux, os.uname() reports the kernel's machine name, so for a 32-bit build the two can differ when the build machine and the test machine see the same architecture under different names: linux-i686 != linux-x86_64 for Debian i386 packages on an x86_64 kernel, linux-armv7l != linux-armv8l for Ubuntu armhf, and so on.

The recorded value describes the build and is not wrong, so this only relaxes the test: when the two platforms differ and the running interpreter is a 32-bit Linux build, the test now skips instead of failing. In every other case the comparison stays strict, including for a mismatch seen by a 64-bit build.

Testing (Linux x86_64, debug build):

./python -m test test_build_details test_sysconfig passes with the unmodified file, so the strict comparison still holds when the values match.
With the recorded platform changed to linux-i686, the old test fails with AssertionError: linux-i686 != linux-x86_64, the same pair reported in the issue. With this change the test skips for a 32-bit interpreter (simulated with sys.maxsize = 2**31 - 1, the same approach test_sysconfig uses) and still fails for a 64-bit one, where a mismatch is not expected.

…ent machine name

The platform recorded in build-details.json describes the build machine,
while sysconfig.get_platform() at test time reports the kernel's machine
name, which can differ for a 32-bit process on a 64-bit kernel.
@python-cla-bot

python-cla-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Nov 12, 2026

Copy link
Copy Markdown

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 skip news label instead.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@FFY00: Is test_build_details.test_platform() test really useful? It fails if the runtime platform is different than the build platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants