Skip to content

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 18, 2025

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

Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
@vstinner
Copy link
Member Author

vstinner commented Sep 18, 2025

cc @cmaloney

Sadly, it's hard to write a benchmark for this C function (_bufferedreader_read_generic()), since the io module reads more data than requested and then cache it. Following file.read() calls will call _bufferedreader_read_fast() instead.

@vstinner vstinner merged commit 9b35f7c into python:main Sep 18, 2025
47 checks passed
@vstinner vstinner deleted the pybyteswriter_buffered_read branch September 18, 2025 15:00
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