From 34c29ae0fd3971f2fa1d038141939ed957433fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Thu, 22 Sep 2022 21:47:36 +0700 Subject: [PATCH] python3-bitarray: fix build for Python 3.11 --- .../patches/python-3.11.patch | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 srcpkgs/python3-bitarray/patches/python-3.11.patch diff --git a/srcpkgs/python3-bitarray/patches/python-3.11.patch b/srcpkgs/python3-bitarray/patches/python-3.11.patch new file mode 100644 index 00000000000..372e200988f --- /dev/null +++ b/srcpkgs/python3-bitarray/patches/python-3.11.patch @@ -0,0 +1,56 @@ +--- a/bitarray/_bitarray.c ++++ b/bitarray/_bitarray.c +@@ -118,7 +118,11 @@ resize(bitarrayobject *self, idx_t nbits + */ + if (allocated >= newsize && newsize >= (allocated >> 1)) { + assert(self->ob_item != NULL || newsize == 0); ++#if PY_VERSION_HEX >= 0x03090000 ++ Py_SET_SIZE(self, newsize); ++#else + Py_SIZE(self) = newsize; ++#endif + self->nbits = nbits; + return 0; + } +@@ -143,7 +147,11 @@ resize(bitarrayobject *self, idx_t nbits + PyErr_NoMemory(); + return -1; + } ++#if PY_VERSION_HEX >= 0x03090000 ++ Py_SET_SIZE(self, newsize); ++#else + Py_SIZE(self) = newsize; ++#endif + self->allocated = new_allocated; + self->nbits = nbits; + return 0; +@@ -164,7 +172,11 @@ newbitarrayobject(PyTypeObject *type, id + return NULL; + + nbytes = (Py_ssize_t) BYTES(nbits); ++#if PY_VERSION_HEX >= 0x03090000 ++ Py_SET_SIZE(obj, nbytes); ++#else + Py_SIZE(obj) = nbytes; ++#endif + obj->nbits = nbits; + obj->endian = endian; + if (nbytes == 0) { +@@ -3222,10 +3234,17 @@ init_bitarray(void) + { + PyObject *m; + ++#if PY_VERSION_HEX >= 0x03090000 ++ Py_SET_TYPE(&Bitarraytype, &PyType_Type); ++ Py_SET_TYPE(&SearchIter_Type, &PyType_Type); ++ Py_SET_TYPE(&DecodeIter_Type, &PyType_Type); ++ Py_SET_TYPE(&BitarrayIter_Type, &PyType_Type); ++#else + Py_TYPE(&Bitarraytype) = &PyType_Type; + Py_TYPE(&SearchIter_Type) = &PyType_Type; + Py_TYPE(&DecodeIter_Type) = &PyType_Type; + Py_TYPE(&BitarrayIter_Type) = &PyType_Type; ++#endif + #ifdef IS_PY3K + m = PyModule_Create(&moduledef); + if (m == NULL)