From 6787a3806ee6a85a6f21ede70c10e15a6df267c4 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 23 Nov 2013 22:12:06 +0200 Subject: Issue #15204: Deprecated the 'U' mode in file-like objects. --- Lib/imp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/imp.py') diff --git a/Lib/imp.py b/Lib/imp.py index 1144cd1f64..c8449c6155 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) -- cgit v1.2.1