patch 9.1.0726: not using correct python3 API with dynamic linking
Problem: not using correct python3 API with dynamic linking
Solution: Use stable IncRef / DecRef in Python 3 dynamic bindings
(Yee Cheng Chin)
Previously, we were using the Py_DECREF macros even when using dynamic
linking of Python 3. This caused issues because Python's headers contain
references to internal APIs like `_Py_Dealloc` and in v8.1.2201 and
v8.2.1225 we simply hacked around the issue by manually copying the
Python header implementation to Vim and linking in the private APIs.
This is fragile and prone to break. In fact, the Py_DECREF
implementation is different in newer versions of Python meaning that
this could potentially cause memory issues.
Instead, simply use the API versions (`Py_DECREF` and `Py_INCREF`) which
are functions exposed by the Python library. They could be slightly
slower since they require a function call instead of a macro, but are
much more reliable and we should only be calling these when the Python
Vim plugins are crossing the language boundary anyway which are always
going to be slow.
Note that this only affects dynamically linked Python builds that are
not using stable ABI.
Also see #15648
closes: #15653
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/version.c b/src/version.c
index 62b2ab5..62f8bcb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 726,
+/**/
725,
/**/
724,