Skip to content

Commit 97a5be4

Browse files
ychinchrisbra
authored andcommitted
patch 9.1.0723: if_python: dynamic linking fails with python3 >= 3.13
Problem: if_python: dynamic linking fails with python3 >= 3.13 when using non-stable ABI (zdohnal) Solution: do not try to import the privat python symbol _PyObject_NextNotImplemented (Yee Cheng Chin) Vim is importing a private Python symbol `_PyObject_NextNotImplemented` because it used to be required as part of the `PyIter_Check()` macro in an abstraction breaking way. Python eventually fixed the issue and in 3.13 it removed the private symbol export, which broke Vim. Simply remove importing this private symbol in newer Python versions as it's no longer needed for PyIter_Check to work. fixes: #15457 closes: #15649 Signed-off-by: Yee Cheng Chin <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 701c863 commit 97a5be4

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/if_python3.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ static HINSTANCE hinstPy3 = 0; // Instance of python.dll
267267
# define _Py_NoneStruct (*py3__Py_NoneStruct)
268268
# define _Py_FalseStruct (*py3__Py_FalseStruct)
269269
# define _Py_TrueStruct (*py3__Py_TrueStruct)
270-
# ifndef USE_LIMITED_API
270+
# if !defined(USE_LIMITED_API) && PY_VERSION_HEX < 0x030D0000
271+
// Private symbol that used to be required as part of PyIter_Check.
271272
# define _PyObject_NextNotImplemented (*py3__PyObject_NextNotImplemented)
272273
# endif
273274
# define PyModule_AddObject py3_PyModule_AddObject
@@ -482,7 +483,7 @@ static void (*py3_PyErr_Clear)(void);
482483
static PyObject* (*py3_PyErr_Format)(PyObject *, const char *, ...);
483484
static void (*py3_PyErr_PrintEx)(int);
484485
static PyObject*(*py3__PyObject_Init)(PyObject *, PyTypeObject *);
485-
# ifndef USE_LIMITED_API
486+
# if !defined(USE_LIMITED_API) && PY_VERSION_HEX < 0x030D0000
486487
static iternextfunc py3__PyObject_NextNotImplemented;
487488
# endif
488489
static PyObject* py3__Py_NoneStruct;
@@ -679,7 +680,7 @@ static struct
679680
{"PyEval_SaveThread", (PYTHON_PROC*)&py3_PyEval_SaveThread},
680681
{"_PyArg_Parse_SizeT", (PYTHON_PROC*)&py3_PyArg_Parse},
681682
{"Py_IsInitialized", (PYTHON_PROC*)&py3_Py_IsInitialized},
682-
# ifndef USE_LIMITED_API
683+
# if !defined(USE_LIMITED_API) && PY_VERSION_HEX < 0x030D0000
683684
{"_PyObject_NextNotImplemented", (PYTHON_PROC*)&py3__PyObject_NextNotImplemented},
684685
# endif
685686
{"_Py_NoneStruct", (PYTHON_PROC*)&py3__Py_NoneStruct},

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
723,
707709
/**/
708710
722,
709711
/**/

0 commit comments

Comments
 (0)