You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sysconfig.get_platform should match the build platform #162323
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.
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.
Changing the semantics of sysconfig.get_platform from returning information about the runtime platform/OS/architecture to returning all the values observed at build time (the way it's done in gh-162336 at least) is like to cause regressions for multiple cases and tools - that seems unhealthy. Currently the behavior is already mixed, with some parts of the returned platform string containing build time and others runtime information.
It may be an option to specifically fix the interpreter value returned by get_platform while leaving the OS and CPU architecture unchanged. That seems like a reasonable bug fix.
A separate sysconfig.get_build_platform() or similar may be better if that limited bug fix isn't enough and there's really a need to know all the original build platform parameters - but it's unclear to me if there is a use case for that.
Activity
rgommers commentedon Nov 25, 2026
Changing the semantics of
sysconfig.get_platformfrom returning information about the runtime platform/OS/architecture to returning all the values observed at build time (the way it's done in gh-162336 at least) is like to cause regressions for multiple cases and tools - that seems unhealthy. Currently the behavior is already mixed, with some parts of the returned platform string containing build time and others runtime information.It may be an option to specifically fix the interpreter value returned by
get_platformwhile leaving the OS and CPU architecture unchanged. That seems like a reasonable bug fix.A separate
sysconfig.get_build_platform()or similar may be better if that limited bug fix isn't enough and there's really a need to know all the original build platform parameters - but it's unclear to me if there is a use case for that.