10000 Fix PathFinder.find_module AttributeError for Python 3.12 by wookayin · Pull Request #1176 · python-mode/python-mode · GitHub
[go: up one dir, main page]

Skip to content

Fix PathFinder.find_module AttributeError for Python 3.12 #1176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

wookayin
Copy link
Contributor

PathFinder.find_module() has been deprecated since Python 3.4 in favor of find_spec(), and it's finally removed in Python 3.12. This line will throw an AttributeError which makes pymode completely unusable with python 3.12.

It was a hacky workaround introduced in #1028. Maybe we can completely remove this workaround because it's 4 years ago and the minimum supported python version is now 3.6+.

I'm not sure if we can completely remove this monkey-patching at this point because I cannot guess where vim.find_module is ever used, but I'll leave it as the most compatible fallback.

Ref:

PathFinder.find_module() has been deprecated since Python 3.4 in favor of
find_spec(), and it's finally removed in Python 3.12. This line will
throw an AttributeError which makes pymode completely unusable with
python 3.12.

It was a hacky workaround introduced in python-mode#1028. Maybe we can completely
remove this workaround because it's 4 years ago and the minimum
supported python version is now 3.6+.
Copy link
Contributor
@diraol diraol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that we are not talking about the python version related to the code that is being edited and sometimes not even the python version from the current environment. It is the python version that was used during vim build time.

Just to be in the safe zone here I think we can leave this "monkey patch", but with your suggestion.

@diraol diraol merged commit e01c27e into python-mode:develop Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0