mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-39674: Revert "bpo-37330: open() no longer accept 'U' in file mode (GH-16959)" (GH-18767)
This reverts commit e471e72977
.
The mode will be removed from Python 3.10.
This commit is contained in:
parent
00c77ae55a
commit
942f7a2dea
13 changed files with 99 additions and 54 deletions
|
@ -225,7 +225,7 @@ def load_module(name, file, filename, details):
|
|||
|
||||
"""
|
||||
suffix, mode, type_ = details
|
||||
if mode and (not mode.startswith('r') or '+' in mode):
|
||||
if mode and (not mode.startswith(('r', 'U')) 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