Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-101144: Allow open and read_text encoding to be positional.#101145
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
gh-101144: Allow open and read_text encoding to be positional.#101145
Uh oh!
There was an error while loading.Please reload this page.
Conversation
As was the behavior in 3.9 and earlier. The fix forpython#87817 introduced an APIregression in 3.10.0b1.
Uh oh!
There was an error while loading.Please reload this page.
This preserves the intent ofpython#87817 while restoring theability to pass `encoding` as a positional argument.
(internally at work the bug this fixes comes from b/266007820) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This change will need to be ported to zipp as well.
If only the affected user had been using the backport for forward-compatibility, they would have discovered this issue much earlier. On further consideration, I guess it's not a matter of forward compatibility (as zipp will often be ahead of some slightly stale Python version). The issue really lies in that the code is only tested on one major version.
This change is mostly fine, but I have some concerns I'd like to see investigated/addressed before proceeding.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
bedevere-bot commentedJan 19, 2023
When you're done making the requested changes, leave the comment: |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
I have made the requested changes; please review again. |
bedevere-bot commentedJan 20, 2023
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Thanks@gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Sorry,@gpshead, I could not cleanly backport this to |
Sorry@gpshead, I had trouble checking out the |
…ional. (pythonGH-101145)The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time..(cherry picked from commit5927013)Co-authored-by: Gregory P. Smith <greg@krypto.org>
#101179 applies it to 3.11 and will be proposed as a 3.10 backport, though we may just update the 3.10 docs and not fix it in that branch. |
…onal. (python/cpython#101145)The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time.
…onal. (python/cpython#101145)The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time.
…n 3.12.0Gregory P. Smith (1):python/cpython#101144: Allow open and read_text encoding to be positional. (python/cpython#101145)Jason R. Coombs (13): Honor ResourceWarnings.Fixesjaraco/skeleton#73. tox 4 requires a boolean value, so use '1' to FORCE_COLOR.Fixesjaraco/skeleton#74. Remove unnecessary shebang and encoding header in docs conf. Prevent Python 3.12 from blocking checks. Build docs in CI, including sphinx-lint. Put tidelift docs dependency in its own section to limit merge conflicts. Update badge for 2023 Update changelog. Refpython/cpython#101144. Invoke test_encoding_warnings in-process, but skip when warn_default_encoding is not set. Re-use alpharep fixture for the file. Provide 'sys.flags.warn_default_encoding' for the tests to skip prior to 3.10. Due to mypy, it's not possible to patch the value, so just be lenient in access. Prefer simple asserts Replace trailing comment with a comment on a separate line.
Uh oh!
There was an error while loading.Please reload this page.
This was the behavior in 3.9 and earlier. The fix for#87817 introduced an API regression in 3.10.0b1.
zipfile.Path.read_text
&.open
methods with a positionalencoding
arg causes a TypeError #101144