Skip to content

gh-158445: Allocate memory in the heap in Py_GetVersion() - #158608

Merged
vstinner merged 2 commits into
python:mainfrom
vstinner:getversion
Oct 3, 2026
Merged

vstinner merged 2 commits into
python:mainfrom
vstinner:getversion

Conversation

@vstinner

@vstinner vstinner commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Py_GetVersion() now allocates memory on the heap, instead of using a static buffer, to no longer truncate the version if it's longer than 299 bytes.

Update Py_GetCompiler() and Py_GetBuildInfo() tests: they are now always a part of sys.version.

Py_GetVersion() now allocates memory on the heap, instead of using a
static buffer, to no longer truncate the version if it's longer than
299 bytes.

Update Py_GetCompiler() and Py_GetBuildInfo() tests: they are now
always a part of sys.version.
@read-the-docs-community

read-the-docs-community Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34907310 | 📁 Comparing ef0a101 against main (be87a85)

  🔍 Preview build  

2 files changed
± c-api/interp-lifecycle.html
± whatsnew/changelog.html

@vstinner

vstinner commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

On my Fedora 44, __clang_version__ is short: 22.1.8 (Fedora 22.1.8-4.fc44). But in issue gh-157368, way longer version has been seen: 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211). On Windows, PC/pyconfig.h no longer uses __clang_version__. But we may such long clang version on other platforms.

@vstinner
vstinner merged commit f5e913c into python:main Oct 3, 2026
54 checks passed
@vstinner
vstinner deleted the getversion branch October 3, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant