From afc201a3e7416d95fb3238558b589223ffc0b07f Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Thu, 21 Sep 2023 22:45:53 -0400 Subject: [PATCH] Fix PathFinder.find_module AttributeError for Python 3.12 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+. --- pymode/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pymode/__init__.py b/pymode/__init__.py index aba22870..906d7059 100644 --- a/pymode/__init__.py +++ b/pymode/__init__.py @@ -6,7 +6,13 @@ import vim # noqa if not hasattr(vim, 'find_module'): - vim.find_module = _PathFinder.find_module + try: + vim.find_module = _PathFinder.find_module # deprecated + except AttributeError: + def _find_module(package_name): + spec = _PathFinder.find_spec(package_name) + return spec.loader if spec else None + vim.find_module = _find_module def auto(): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy