Skip to content

Commit b9eff51

Browse files
authored
Merge #297 'Fix VimPathFinder.find_spec (Python 3.4+)'
2 parents f0c6ab0 + 6f237db commit b9eff51

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

neovim/plugin/script_host.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ def __init__(self, module):
227227

228228
def load_module(self, fullname, path=None):
229229
# Check sys.modules, required for reload (see PEP302).
230-
if fullname in sys.modules:
230+
try:
231231
return sys.modules[fullname]
232+
except KeyError:
233+
pass
232234
return imp.load_module(fullname, *self.module)
233235

234236
class VimPathFinder(object):
@@ -242,9 +244,9 @@ def find_module(fullname, path=None):
242244
return None
243245

244246
@staticmethod
245-
def find_spec(fullname, path=None, target=None):
247+
def find_spec(fullname, target=None):
246248
"""Method for Python 3.4+."""
247-
return PathFinder.find_spec(fullname, path or _get_paths(), target)
249+
return PathFinder.find_spec(fullname, _get_paths(), target)
248250

249251
def hook(path):
250252
if path == nvim.VIM_SPECIAL_PATH:

0 commit comments

Comments
 (0)