diff options
author | Victor Stinner <vstinner@python.org> | 2021-09-02 10:58:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-02 10:58:00 (GMT) |
commit | 19ba2122ac7313ac29207360cfa864a275b9489e (patch) | |
tree | ab34611e2b6158889cabec93f76f40c71b6ea470 /Lib/fileinput.py | |
parent | a8066087054417885db0a2dbdce2ddb2ac498247 (diff) | |
download | cpython-19ba2122ac7313ac29207360cfa864a275b9489e.zip cpython-19ba2122ac7313ac29207360cfa864a275b9489e.tar.gz cpython-19ba2122ac7313ac29207360cfa864a275b9489e.tar.bz2 |
bpo-37330: open() no longer accept 'U' in file mode (GH-28118)
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.
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r-- | Lib/fileinput.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py index 3534718..d0b3caa 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -217,15 +217,10 @@ class FileInput: EncodingWarning, 2) # restrict mode argument to reading modes - if mode not in ('r', 'rU', 'U', 'rb'): - raise ValueError("FileInput opening mode must be one of " - "'r', 'rU', 'U' and 'rb'") - if 'U' in mode: - import warnings - warnings.warn("'U' mode is deprecated", - DeprecationWarning, 2) + if mode not in ('r', 'rb'): + raise ValueError("FileInput opening mode must be 'r' or 'rb'") self._mode = mode - self._write_mode = mode.replace('r', 'w') if 'U' not in mode else 'w' + self._write_mode = mode.replace('r', 'w') if openhook: if inplace: raise ValueError("FileInput cannot use an opening hook in inplace mode") |