summaryrefslogtreecommitdiffstats
path: root/Lib/imp.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-09-02 10:58:00 (GMT)
committerGitHub <noreply@github.com>2021-09-02 10:58:00 (GMT)
commit19ba2122ac7313ac29207360cfa864a275b9489e (patch)
treeab34611e2b6158889cabec93f76f40c71b6ea470 /Lib/imp.py
parenta8066087054417885db0a2dbdce2ddb2ac498247 (diff)
downloadcpython-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/imp.py')
-rw-r--r--Lib/imp.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/imp.py b/Lib/imp.py
index e02aaef..71c5c8f 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -226,7 +226,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_)