Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitafc201a

Browse files
committed
Fix PathFinder.find_module AttributeError for Python 3.12
PathFinder.find_module() has been deprecated since Python 3.4 in favor offind_spec(), and it's finally removed in Python 3.12. This line willthrow an AttributeError which makes pymode completely unusable withpython 3.12.It was a hacky workaround introduced in#1028. Maybe we can completelyremove this workaround because it's 4 years ago and the minimumsupported python version is now 3.6+.
1 parent57384b9 commitafc201a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎pymode/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
importvim# noqa
77

88
ifnothasattr(vim,'find_module'):
9-
vim.find_module=_PathFinder.find_module
9+
try:
10+
vim.find_module=_PathFinder.find_module# deprecated
11+
exceptAttributeError:
12+
def_find_module(package_name):
13+
spec=_PathFinder.find_spec(package_name)
14+
returnspec.loaderifspecelseNone
15+
vim.find_module=_find_module
1016

1117

1218
defauto():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp