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-51511: Note that codecs.open()'s encoding parameter affects automatic conversion to binary mode #94370

Merged
merged 2 commits into from
Oct 21, 2022

Conversation

slateny
Copy link
Contributor

@slateny slateny commented Jun 28, 2022

#51511

Partially related: #54553

codecs.open docs

See

cpython/Lib/codecs.py

Lines 901 to 904 in bc7f6fc

if encoding is not None and \
'b' not in mode:
# Force opening of the file in binary mode
mode = mode + 'b'

Affected lines found by grep 'always opened in binary' -r

@gvanrossum
Copy link
Member

gvanrossum commented Oct 21, 2022

Do you want me to merge it? What about backports?

@slateny
Copy link
Contributor Author

slateny commented Oct 21, 2022

Yep looking to get them merged, and backports sound good, I'll add the labels for 3.10/3.11 (I usually let the merger decide since they're the ones doing the extra work there :).

@slateny slateny added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Oct 21, 2022
@gvanrossum gvanrossum merged commit d9407b1 into python:main Oct 21, 2022
@miss-islington
Copy link
Contributor

Thanks @slateny for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 21, 2022
…automatic conversion to binary mode (pythonGH-94370)

(cherry picked from commit d9407b1)

Co-authored-by: Stanley <[email protected]>
@bedevere-bot
Copy link

GH-98533 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Oct 21, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 21, 2022
…automatic conversion to binary mode (pythonGH-94370)

(cherry picked from commit d9407b1)

Co-authored-by: Stanley <[email protected]>
@bedevere-bot
Copy link

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

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Oct 21, 2022
@slateny slateny deleted the s/51511 branch October 21, 2022 23:08
miss-islington added a commit that referenced this pull request Oct 21, 2022
…tic conversion to binary mode (GH-94370)

(cherry picked from commit d9407b1)

Co-authored-by: Stanley <[email protected]>
miss-islington added a commit that referenced this pull request Oct 21, 2022
…tic conversion to binary mode (GH-94370)

(cherry picked from commit d9407b1)

Co-authored-by: Stanley <[email protected]>
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.

4 participants