python3-bitarray: fix build for Python 3.11
This commit is contained in:
parent
4d972fd472
commit
34c29ae0fd
1 changed files with 56 additions and 0 deletions
56
srcpkgs/python3-bitarray/patches/python-3.11.patch
Normal file
56
srcpkgs/python3-bitarray/patches/python-3.11.patch
Normal file
|
@ -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)
|
Loading…
Add table
Add a link
Reference in a new issue