aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/provider/script_host.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2015-06-27 17:03:48 +0200
committerDaniel Hahler <git@thequod.de>2015-07-09 13:43:57 +0200
commit5e3212023660df60186e1cfac8d60ee4e3b026b5 (patch)
treee8dd97bc13dee1410e90d9da746bc31ae01ed646 /runtime/autoload/provider/script_host.py
parentad6dfa666905312fa83d95fd913d76d69e605afc (diff)
downloadrneovim-5e3212023660df60186e1cfac8d60ee4e3b026b5.tar.gz
rneovim-5e3212023660df60186e1cfac8d60ee4e3b026b5.tar.bz2
rneovim-5e3212023660df60186e1cfac8d60ee4e3b026b5.zip
python: path_hook: properly implement PEP302
The path hook used to load the module already in the `find_module` hook. This caused different behaviour between Python 2.7 and 3.3, where the former would call the `VimModuleLoader`, while Python 3.3 appears to short-circuited this (because the module was loaded already). This patch will now only find the module, but not load it in the `find_module` hook.
Diffstat (limited to 'runtime/autoload/provider/script_host.py')
-rw-r--r--runtime/autoload/provider/script_host.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/autoload/provider/script_host.py b/runtime/autoload/provider/script_host.py
index 9bdfc32ef0..10fd74816d 100644
--- a/runtime/autoload/provider/script_host.py
+++ b/runtime/autoload/provider/script_host.py
@@ -201,11 +201,10 @@ def path_hook(nvim):
name = oldtail[:idx]
tail = oldtail[idx+1:]
fmr = imp.find_module(name, path)
- module = imp.load_module(fullname[:-len(oldtail)] + name, *fmr)
+ module = imp.find_module(fullname[:-len(oldtail)] + name, *fmr)
return _find_module(fullname, tail, module.__path__)
else:
- fmr = imp.find_module(fullname, path)
- return imp.load_module(fullname, *fmr)
+ return imp.find_module(fullname, path)
class VimModuleLoader(object):
def __init__(self, module):
@@ -215,7 +214,7 @@ def path_hook(nvim):
# Check sys.modules, required for reload (see PEP302).
if fullname in sys.modules:
return sys.modules[fullname]
- return self.module
+ return imp.load_module(fullname, *self.module)
class VimPathFinder(object):
@staticmethod