Files
macports-ports/python/py-ligo-segments/files/fix-pylist-extend-python313.patch
Paul GuyotandRenee Otten 22ccf75c24 py-ligo-segments: drop py27, add py313 and py314 subports
Fix build with Python 3.13+: _PyList_Extend was removed from CPython
headers in 3.13; use the new public PyList_Extend() API instead.

Signed-off-by: Paul Guyot <pguyot@kallisys.net>
2026-05-15 10:38:50 -04:00

48 lines
1.2 KiB
Diff

--- a/src/segmentlist.c
+++ b/src/segmentlist.c
@@ -240,7 +240,8 @@
}
-static int pylist_extend(PyListObject *l, PyObject *v)
+#if PY_VERSION_HEX < 0x030D0000
+static int PyList_Extend(PyListObject *l, PyObject *v)
{
if(!PyList_Check(l)) {
PyErr_SetObject(PyExc_TypeError, (PyObject *) l);
@@ -252,6 +253,7 @@
Py_DECREF(result);
return 0;
}
+#endif
static PyListObject *segments_SegmentList_New(PyTypeObject *type, PyObject *sequence)
@@ -263,7 +265,7 @@
}
new = (PyListObject *) type->tp_alloc(type, 0);
if(new && sequence)
- if(pylist_extend(new, sequence)) {
+ if(PyList_Extend(new, sequence)) {
Py_DECREF(new);
new = NULL;
}
@@ -817,7 +819,7 @@
/* Faster algorithm when the two lists have very different sizes.
* OK to not test size functions for error return values */
if(PySequence_Size(other) > PyList_GET_SIZE(self) / 2) {
- if(pylist_extend((PyListObject *) self, other))
+ if(PyList_Extend((PyListObject *) self, other))
return NULL;
return PyObject_CallMethod(self, "coalesce", NULL);
}
@@ -988,7 +990,7 @@
Py_XDECREF(other);
return NULL;
}
- if(pylist_extend((PyListObject *) new, other)) {
+ if(PyList_Extend((PyListObject *) new, other)) {
Py_DECREF(new);
Py_DECREF(other);
return NULL;