-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
bpo-37330: open() no longer accept 'U' in file mode #16959
Conversation
open(), io.open(), codecs.open() and fileinput.FileInput no longer accept "U" ("universal newline") in the file mode. This flag was deprecated since Python 3.3. test_fileinput: add tests for 'rU' and 'U' modes Run make regen-all.
This is the rebased PR #14204 that I failed to reopen. docutils and Sphinx were updated: they no longer use open("U"). @serhiy-storchaka: You approved PR #14204, would you mind to approve this PR as well? |
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.
LGTM. It seems test_pty failure is tracked with https://bugs.python.org/issue38547. Thanks Victor.
@serhiy-storchaka: I added more tests, does it look good to you now? |
Lib/test/test_codecs.py
Outdated
# "U" mode has been removed in Python 3.9 | ||
for mode in ("U", "rU", "r+U"): | ||
with self.assertRaises(ValueError) as cm: | ||
codecs.open(support.TESTFN, mode) |
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.
Pass an encoding
.
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.
Ooooh, the codecs module remains a mystery to me :-) Ok, I added an encoding and I added tests for "rt" mode.
@serhiy-storchaka: Sorry, I misunderstood the codecs module for "rt" mode. Adding an encoding was the fix :-) I added more tests for this mode as well. |
open(), io.open(), codecs.open() and fileinput.FileInput no longer accept "U" ("universal newline") in the file mode. This flag was deprecated since Python 3.3.
open(), io.open(), codecs.open() and fileinput.FileInput no longer accept "U" ("universal newline") in the file mode. This flag was deprecated since Python 3.3.
open(), io.open(), codecs.open() and fileinput.FileInput no longer
accept "U" ("universal newline") in the file mode. This flag was
deprecated since Python 3.3.
test_fileinput: add tests for 'rU' and 'U' modes
Run make regen-all.
https://bugs.python.org/issue37330