bpo-37330: open() no longer accept 'U' in file mode#16959
Merged
vstinner merged 3 commits intopython:masterfrom Oct 28, 2019
vstinner:remove_open_universal2
Merged
bpo-37330: open() no longer accept 'U' in file mode#16959vstinner merged 3 commits intopython:masterfrom vstinner:remove_open_universal2
vstinner merged 3 commits intopython:masterfrom
vstinner:remove_open_universal2
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.
Member
Author
|
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? |
tirkarthi
approved these changes
Oct 27, 2019
Member
tirkarthi
left a comment
There was a problem hiding this comment.
LGTM. It seems test_pty failure is tracked with https://bugs.python.org/issue38547. Thanks Victor.
Member
Author
|
@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) |
Member
Author
There was a problem hiding this comment.
Ooooh, the codecs module remains a mystery to me :-) Ok, I added an encoding and I added tests for "rt" mode.
Member
Author
|
@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. |
serhiy-storchaka
approved these changes
Oct 28, 2019
jacobneiltaylor
pushed a commit
to jacobneiltaylor/cpython
that referenced
this pull request
Dec 5, 2019
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.
shihai1991
pushed a commit
to shihai1991/cpython
that referenced
this pull request
Jan 31, 2020
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.
This was referenced Mar 1, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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