summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2024-05-17 18:30:01 +0200
committerChristian Brabandt <cb@256bit.org>2024-05-17 18:30:26 +0200
commitf0905a86130c431eb29395b0eee68867e0c1c2dd (patch)
treeee76732fff873301e89b15f6b9df9c9475236b5e
parent2e642734f4be506483315b8881748a7ef45854f4 (diff)
patch 9.1.0417: if_py: find_module has been removed in Python 3.12.0a7v9.1.0417
Problem: if_py: find_module has been removed in Python 3.12.0a7 (@Ghost-LZW) Solution: Do not include find_module for Python >= 3.12.0a7 fixes: #14776 closes: #14781 Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--runtime/doc/if_pyth.txt11
-rw-r--r--runtime/doc/tags1
-rw-r--r--src/if_py_both.h7
-rw-r--r--src/version.c2
4 files changed, 13 insertions, 8 deletions
diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt
index 8456d08c66..623684152b 100644
--- a/runtime/doc/if_pyth.txt
+++ b/runtime/doc/if_pyth.txt
@@ -1,4 +1,4 @@
-*if_pyth.txt* For Vim version 9.1. Last change: 2023 Oct 25
+*if_pyth.txt* For Vim version 9.1. Last change: 2024 May 16
VIM REFERENCE MANUAL by Paul Moore
@@ -343,7 +343,8 @@ In python vim.VIM_SPECIAL_PATH special directory is used as a replacement for
the list of paths found in 'runtimepath': with this directory in sys.path and
vim.path_hooks in sys.path_hooks python will try to load module from
{rtp}/python2 (or python3) and {rtp}/pythonx (for both python versions) for
-each {rtp} found in 'runtimepath'.
+each {rtp} found in 'runtimepath' (Note: find_module() has been removed from
+imp module around Python 3.12.0a7).
Implementation is similar to the following, but written in C: >
@@ -404,10 +405,12 @@ vim.VIM_SPECIAL_PATH *python-VIM_SPECIAL_PATH*
vim.find_module(...) *python-find_module*
vim.path_hook(path) *python-path_hook*
+vim.find_spec(...) *python-find_spec*
Methods or objects used to implement path loading as described above.
You should not be using any of these directly except for vim.path_hook
- in case you need to do something with sys.meta_path. It is not
- guaranteed that any of the objects will exist in the future vim
+ in case you need to do something with sys.meta_path, vim.find_spec()
+ is available starting with Python 3.7.
+ It is not guaranteed that any of the objects will exist in future vim
versions.
vim._get_paths *python-_get_paths*
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 795851b4bf..d354df1ee5 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -9518,6 +9518,7 @@ python-eval if_pyth.txt /*python-eval*
python-examples if_pyth.txt /*python-examples*
python-fchdir if_pyth.txt /*python-fchdir*
python-find_module if_pyth.txt /*python-find_module*
+python-find_spec if_pyth.txt /*python-find_spec*
python-foreach_rtp if_pyth.txt /*python-foreach_rtp*
python-input if_pyth.txt /*python-input*
python-options if_pyth.txt /*python-options*
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 3e5993bb64..e0fd3eafb0 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -7325,12 +7325,11 @@ populate_module(PyObject *m)
return -1;
}
+# if PY_VERSION_HEX < 0x30c00a7
+ // find_module has been removed as of Python 3.12.0a7
if ((py_find_module = PyObject_GetAttrString(cls, "find_module")))
- {
- // find_module() is deprecated, this may stop working in some later
- // version.
ADD_OBJECT(m, "_find_module", py_find_module);
- }
+# endif
Py_DECREF(imp);
diff --git a/src/version.c b/src/version.c
index cd4c1af65e..682a46873a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 417,
+/**/
416,
/**/
415,