summaryrefslogtreecommitdiffstats
path: root/Lib/imp.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-23 20:12:06 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-23 20:12:06 (GMT)
commit6787a3806ee6a85a6f21ede70c10e15a6df267c4 (patch)
treed72149a2f3a4eab3e8f288fa2a25bb1957620d91 /Lib/imp.py
parentd41c343f28bd7631cfa866f8276673ccafb71d57 (diff)
downloadcpython-6787a3806ee6a85a6f21ede70c10e15a6df267c4.zip
cpython-6787a3806ee6a85a6f21ede70c10e15a6df267c4.tar.gz
cpython-6787a3806ee6a85a6f21ede70c10e15a6df267c4.tar.bz2
Issue #15204: Deprecated the 'U' mode in file-like objects.
Diffstat (limited to 'Lib/imp.py')
-rw-r--r--Lib/imp.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/imp.py b/Lib/imp.py
index 1144cd1..c8449c6 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -103,7 +103,7 @@ def source_from_cache(path):
def get_suffixes():
"""**DEPRECATED**"""
extensions = [(s, 'rb', C_EXTENSION) for s in machinery.EXTENSION_SUFFIXES]
- source = [(s, 'U', PY_SOURCE) for s in machinery.SOURCE_SUFFIXES]
+ source = [(s, 'r', PY_SOURCE) for s in machinery.SOURCE_SUFFIXES]
bytecode = [(s, 'rb', PY_COMPILED) for s in machinery.BYTECODE_SUFFIXES]
return extensions + source + bytecode
@@ -297,7 +297,7 @@ def find_module(name, path=None):
raise ImportError(_ERR_MSG.format(name), name=name)
encoding = None
- if mode == 'U':
+ if 'b' not in mode:
with open(file_path, 'rb') as file:
encoding = tokenize.detect_encoding(file.readline)[0]
file = open(file_path, mode, encoding=encoding)