mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-37330: open() no longer accept 'U' in file mode (GH-16959)
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 commit is contained in:
parent
3bfc8e0fcc
commit
e471e72977
13 changed files with 57 additions and 96 deletions
|
@ -225,7 +225,7 @@ def load_module(name, file, filename, details):
|
|||
|
||||
"""
|
||||
suffix, mode, type_ = details
|
||||
if mode and (not mode.startswith(('r', 'U')) or '+' in mode):
|
||||
if mode and (not mode.startswith('r') or '+' in mode):
|
||||
raise ValueError('invalid file open mode {!r}'.format(mode))
|
||||
elif file is None and type_ in {PY_SOURCE, PY_COMPILED}:
|
||||
msg = 'file object required for import (type code {})'.format(type_)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue