Skip to content

gh-158585: Simplify PyBytesWriter_Finish() - #158822

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:writer_with_size
Oct 5, 2026
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:writer_with_size

Conversation

@vstinner

@vstinner vstinner commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

PyBytesWriter_Finish() doesn't need to check the size. It's known to be valid.

PyBytesWriter_Create() now only calls byteswriter_resize() if the size is larger than the small buffer.

Remove byteswriter_data() function: call static inline _PyBytesWriter_GetData() function directly.

PyBytesWriter_Finish() doesn't need to check the size. It's known to
be valid.

PyBytesWriter_Create() now only calls byteswriter_resize() if the
size is larger than the small buffer.

Remove byteswriter_data() function: call static inline
_PyBytesWriter_GetData() function directly.
@vstinner
vstinner merged commit 30ce3d4 into python:main Oct 5, 2026
56 checks passed
@vstinner
vstinner deleted the writer_with_size branch October 5, 2026 02:47
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