Skip to content

Commit 6f237db

Browse files
committed
Use EAFP for checking existing module in sys.modules
1 parent 5b69f54 commit 6f237db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

neovim/plugin/script_host.py

Lines changed: 3 additions & 1 deletion
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):

0 commit comments

Comments
 (0)