Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e01c27e

Browse files
authored
Merge pull request #1176 from wookayin/py312-find-module
Fix PathFinder.find_module AttributeError for Python 3.12
2 parents 57384b9 + afc201a commit e01c27e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pymode/__init__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
import vim # noqa
77

88
if not hasattr(vim, 'find_module'):
9-
vim.find_module = _PathFinder.find_module
9+
try:
10+
vim.find_module = _PathFinder.find_module # deprecated
11+
except AttributeError:
12+
def _find_module(package_name):
13+
spec = _PathFinder.find_spec(package_name)
14+
return spec.loader if spec else None
15+
vim.find_module = _find_module
1016

1117

1218
def auto():

0 commit comments

Comments
 (0)