Uh oh!
There was an error while loading. Please reload this page.
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.vstinner
commented
Oct 27, 2019
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
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vstinner
commented
Oct 28, 2019
@serhiy-storchaka: I added more tests, does it look good to you now? |
| # "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.
Ooooh, the codecs module remains a mystery to me :-) Ok, I added an encoding and I added tests for "rt" mode.
vstinner
commented
Oct 28, 2019
@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