FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-129813, PEP 782: Use PyBytesWriter in _hashopenssl by vstinner · Pull Request #138922 · python/cpython · GitHub

Repository navigation

gh-129813, PEP 782: Use PyBytesWriter in _hashopenssl - #138922

Merged
vstinner merged 2 commits into
python:mainfrom
vstinner:pybyteswriter_hashopenssl
Sep 15, 2025
Merged

vstinner merged 2 commits into
python:mainfrom
vstinner:pybyteswriter_hashopenssl

Conversation

vstinner commented Sep 15, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Replace PyBytes_FromStringAndSize(NULL, size) with the new public PyBytesWriter API.

Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.

Copy link
Copy Markdown
Member Author

cc @picnixz

Comment thread Modules/_hashopenssl.c Outdated
Comment thread Modules/_hashopenssl.c Outdated

Copy link
Copy Markdown
Member Author

@picnixz: Please review the updated code.

picnixz commented Sep 15, 2025 •
edited
Loading

Copy link
Copy Markdown
Member

Wait, does Create overallocate the buffer? because in sha3 and hashopenssl we don't need extra bytes (we just need the exact size that is asked).

Copy link
Copy Markdown
Member Author

Wait, does Create overallocate the buffer? because in sha3 and hashopenssl we don't need extra bytes (we just need the exact size that is asked).

PyBytesWrite_Create(n) allocates exactly n bytes, it doesn't use overallocation. Only PyBytesWriter_Grow() and PyBytesWriter_Resize() use overallocation.

vstinner merged commit a68efdf into python:main Sep 15, 2025
47 checks passed
vstinner deleted the pybyteswriter_hashopenssl branch September 15, 2025 16:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL