Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-129005: Update _pyio.BytesIO to use bytearray.resize on write #129702

Merged
merged 3 commits into from
Feb 6, 2025

Conversation

cmaloney
Copy link
Contributor

@cmaloney cmaloney commented Feb 5, 2025

bytearray.resize() does the nulling if needed. Including the new write length, n, since doing two resizes in a row to do the memcpy doesn't seem worthwhile.

I think this can skip news as it's internal implementation change with no visible external changes, should just be faster.

Lib/_pyio.py Outdated Show resolved Hide resolved
Co-authored-by: Victor Stinner <[email protected]>
Lib/_pyio.py Outdated Show resolved Hide resolved
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner vstinner enabled auto-merge (squash) February 6, 2025 09:56
@vstinner vstinner merged commit 052ca8f into python:main Feb 6, 2025
42 checks passed
@cmaloney cmaloney deleted the cmaloney/pyio_readinto_resize branch February 6, 2025 17:46
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
cmaloney added a commit to cmaloney/cpython that referenced this pull request Feb 8, 2025
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