Skip to content

bpo-44439: BZ2File.write() / LZMAFile.write() handle buffer protocol correctly #26764

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

Merged
merged 2 commits into from Jun 22, 2021
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jun 17, 2021

The underlying C codes handle buffer protocol objects correctly, so only fix the wrong length in Python code is fine.

https://bugs.python.org/issue44439

No longer use len() to get the length of the input data. For some buffer protocol objects, the length obtained by using len() is wrong.
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM.

@serhiy-storchaka serhiy-storchaka added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Jun 22, 2021
@serhiy-storchaka serhiy-storchaka merged commit bc6c12c into python:main Jun 22, 2021
@miss-islington
Copy link
Contributor

Thanks @animalize for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @animalize and @serhiy-storchaka, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker bc6c12c72a9536acc96e7b9355fd69d1083a43c1 3.9

@bedevere-bot
Copy link

GH-26845 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 22, 2021
…correctly (pythonGH-26764)

No longer use len() to get the length of the input data. For some buffer protocol objects,
the length obtained by using len() is wrong.
(cherry picked from commit bc6c12c)

Co-authored-by: Ma Lin <[email protected]>
@ghost ghost deleted the input_len branch June 22, 2021 07:12
@ghost
Copy link
Author

ghost commented Jun 22, 2021

3.9 branch has a code conflict, I created PR #26846 for 3.9 branch.

serhiy-storchaka pushed a commit that referenced this pull request Jun 22, 2021
…correctly (GH-26764) (GH-26845)

No longer use len() to get the length of the input data. For some buffer protocol objects,
the length obtained by using len() is wrong.
(cherry picked from commit bc6c12c)

Co-authored-by: Ma Lin <[email protected]>
@serhiy-storchaka serhiy-storchaka removed the needs backport to 3.9 only security fixes label Nov 10, 2023
@serhiy-storchaka serhiy-storchaka removed their assignment Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants