Skip to content

platform._sys_version() raises exception when __DATE__ is undefined at build-time #100388

Open
@fosslinux

Description

@fosslinux

Bug report

If __DATE__ is undefined at build time (eg, CPPFLAGS=-U__DATE__), in the sys.version string, the date portion is set to xx/xx/xx. However the __DATE__ string follows MMM DD YYYY format.

platform._sys_version() does not know how to interpret xx/xx/xx, expecting MMM DD YYYY, so it raises an exception (ValueError: failed to parse CPython sys.version).

Your environment

  • CPython versions tested on: exists from at least 3.8
  • Operating system and architecture: irrelevant, any compiler where you can undefine DATE or it is not defined.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions