1
0
forked from VimPlug/jedi

some builtin modules have a very strange import behaviour. removes the stacktrace of #59

This commit is contained in:
David Halter
2012-11-12 18:50:58 +01:00
parent c6cbe61538
commit b70a642d28

View File

@@ -101,8 +101,13 @@ class Parser(CachedModule):
temp, sys.path = sys.path, self.sys_path temp, sys.path = sys.path, self.sys_path
content = {} content = {}
exec_function('import %s as module' % name, content) try:
self._module = content['module'] exec_function('import %s as module' % name, content)
self._module = content['module']
except AttributeError:
# use sys.modules, because you cannot access some modules
# directly. -> #59
self._module = sys.modules[name]
sys.path = temp sys.path = temp
if path: if path: