Skip to content

Rework Modules/getbuildinfo.c to build strings at build time, instead of runtime #158948

Description

@vstinner

Python has a collection of C files to get "build information"

  • Modules/getbuildinfo.c
  • Python/getcompiler.c
  • Python/getcopyright.c
  • Python/getplatform.c
  • Python/getversion.c

_Py_gitidentifier(), Py_GetBuildInfo() and Py_GetVersion() build strings at runtime. For example, Python/getversion.c uses a static buffer of a fixed size: static char version[300];. Well, I recently changed that to allocate the version string in the heap memory to no longer truncate the string: #158608.

I propose to rework these files to build strings at build time, no longer truncate strings, and don't need to build strings at runtime (no error handling needed).

Linked PRs

No activity

Activity on this issue will appear here.

Activity

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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-refactorCode refactoring (with no changes in behavior)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions