mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-13 18:42:30 +08:00
Fix UnicodeDecodeError
Open binary file in binary mode. This happens in py34 because they fixed the missing ``get_filename`` attribute of ExtensionLoader
This commit is contained in:
@@ -31,7 +31,8 @@ def find_module_py33(string, path=None):
|
|||||||
module_file = None
|
module_file = None
|
||||||
else:
|
else:
|
||||||
module_path = loader.get_filename(string)
|
module_path = loader.get_filename(string)
|
||||||
mode = 'rb' if module_path.endswith(".pyc") else 'r'
|
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, mode)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# ExtensionLoader has not attribute get_filename, instead it has a
|
# ExtensionLoader has not attribute get_filename, instead it has a
|
||||||
|
|||||||
Reference in New Issue
Block a user