Skip to content

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

Merged
serhiy-storchaka merged 2 commits into
mainfrom
unknown repository
Jun 22, 2021
Merged

bpo-44439: BZ2File.write() / LZMAFile.write() handle buffer protocol correctly#26764
serhiy-storchaka merged 2 commits into
mainfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@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.
Comment thread Lib/test/test_gzip.py Outdated
Comment thread Lib/bz2.py Outdated
Copy link
Copy Markdown
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.

@miss-islington
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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 <animalize@users.noreply.github.com>
@ghost ghost deleted the input_len branch June 22, 2021 07:12
@ghost
Copy link
Copy Markdown
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 <animalize@users.noreply.github.com>
@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