diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-23 20:12:06 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-23 20:12:06 (GMT) |
commit | 6787a3806ee6a85a6f21ede70c10e15a6df267c4 (patch) | |
tree | d72149a2f3a4eab3e8f288fa2a25bb1957620d91 /Lib/imp.py | |
parent | d41c343f28bd7631cfa866f8276673ccafb71d57 (diff) | |
download | cpython-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.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |