forked from VimPlug/jedi
Always load source files in binary mode.
Source files can be in any coding system, provided Python can read a coding: line at the beginning of the file. So source files should be loaded in binary format and decoded according to that line, not assumed to be in the default coding system. Fixes #398.
This commit is contained in:
@@ -31,9 +31,7 @@ def find_module_py33(string, path=None):
|
||||
module_file = None
|
||||
else:
|
||||
module_path = loader.get_filename(string)
|
||||
module_ext = os.path.splitext(module_path)[1]
|
||||
mode = 'rb' if module_ext in ['.pyc', '.so', '.pyd'] else 'r'
|
||||
module_file = open(module_path, mode)
|
||||
module_file = open(module_path, 'rb')
|
||||
except AttributeError:
|
||||
# ExtensionLoader has not attribute get_filename, instead it has a
|
||||
# path attribute that we can use to retrieve the module path
|
||||
|
||||
Reference in New Issue
Block a user