Skip to content

Commit a5446ce

Browse files
refactor: Reduce usage of deprecated imp module #455
Replace imp.new_module with types.ModuleType which is available from py2.7 to 3+ related: #369
1 parent ead0dca commit a5446ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pynvim/plugin/script_host.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import os
66
import sys
7+
from types import ModuleType
78

89
from pynvim.api import Nvim, walk
910
from pynvim.compat import IS_PYTHON3
@@ -37,7 +38,7 @@ def __init__(self, nvim):
3738
"""Initialize the legacy python-vim environment."""
3839
self.setup(nvim)
3940
# context where all code will run
40-
self.module = imp.new_module('__main__')
41+
self.module = ModuleType('__main__')
4142
nvim.script_context = self.module
4243
# it seems some plugins assume 'sys' is already imported, so do it now
4344
exec('import sys', self.module.__dict__)

0 commit comments

Comments
 (0)