Skip to content

sysconfig.get_platform should match the build platform #162323

Description

@FFY00

Bug report

In GH-161870, we noticed that sysconfig.get_platform may not match the build platform when running on a compatible architecture — eg. 32 bit build running on a 64 bit machine.

From its documentation:

This is used mainly to distinguish platform-specific build directories and platform-specific built distributions.

To be able to use the function for this purpose, it must return the build platform. Otherwise, we may end up trying to use a 64 bit wheel on a 32 bit build.

Typically includes the OS name and version and the architecture (as supplied by os.uname()), although the exact information included depends on the OS; e.g., on Linux, the kernel version isn’t particularly important.

It does mention os.uname specifically as the source, though I think it's written some wiggle room.

IMO, the main issue with changing the behavior is existing code maybe relying on this edge case. If we decide to not change it, then we should provide another way to get the proper build platform.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-sysconfigtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions