Skip to content

sysconfig.get_platform() could return wrong value because sys.version is truncated #145410

@char101

Description

@char101

Bug report

Bug description:

On Windows, sysconfig.get_platform() checks for the string amd64 (for 64 intel) in sys.version.

This is the value of sys.version for python 3.14.3 (64 bit) compiled with clang 22.1.0

>>> sys.version
'3.14.3 (main, Mar  2 2026, 14:42:29) [Clang 22.1.0 (https://github.com/llvm/llvm-project 4434dabb69916856b824f68a64b0'
>>> sysconfig.get_platform()
'win32'
>>> import platform
>>> platform.architecture()[0]
'64bit'

As visible, there is no amd64 in sys.version, because it is truncated. This causes problem when installing native package using pip because cp314-cp314-amd64 is not in the list of supported tags. Instead, the supported tags list become

Compatible tags: 48
  cp314-cp314-win32
  cp314-abi3-win32
  cp314-none-win32
  cp313-abi3-win32
  cp312-abi3-win32
  cp311-abi3-win32
  cp310-abi3-win32
  cp39-abi3-win32
  cp38-abi3-win32
  cp37-abi3-win32
  cp36-abi3-win32
  cp35-abi3-win32
  cp34-abi3-win32
  cp33-abi3-win32
  cp32-abi3-win32
  (truncated)

CPython versions tested on:

3.14

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions