From a75773cf9f7a9fde2a7b2c77b9846b4f0dd5b711 Mon Sep 17 00:00:00 2001 From: ColinDuquesnoy Date: Mon, 17 Feb 2014 09:08:30 +0100 Subject: [PATCH] Fix import of compiled module with python3. This at least fix #331 --- jedi/_compatibility.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 9cce90a5..fa42abb1 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -33,10 +33,16 @@ def find_module_py33(string, path=None): module_path = loader.get_filename(string) module_file = open(module_path) except AttributeError: - # is builtin module - module_path = string - module_file = None - is_package = False + # ExtensionLoader has not attribute get_filename, instead it has a + # path attribute that we can use to retrieve the module path + try: + module_path = loader.path + module_file = open(loader.path, 'rb') + except AttributeError: + module_path = string + module_file = None + finally: + is_package = False return module_file, module_path, is_package