bitarray 3.7.1__tar.gz → 3.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bitarray-3.7.1 → bitarray-3.8.0}/PKG-INFO +15 -12
- {bitarray-3.7.1 → bitarray-3.8.0}/README.rst +12 -11
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/__init__.py +4 -6
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/__init__.pyi +0 -1
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/_bitarray.c +29 -50
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/_util.c +6 -1
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/bitarray.h +5 -2
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/pythoncapi_compat.h +391 -2
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/test_bitarray.py +51 -74
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/test_util.py +35 -63
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/util.py +6 -12
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray.egg-info/PKG-INFO +15 -12
- {bitarray-3.7.1 → bitarray-3.8.0}/setup.py +3 -1
- {bitarray-3.7.1 → bitarray-3.8.0}/LICENSE +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/py.typed +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/test_281.pickle +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray/util.pyi +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray.egg-info/SOURCES.txt +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray.egg-info/dependency_links.txt +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray.egg-info/not-zip-safe +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/bitarray.egg-info/top_level.txt +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/pyproject.toml +0 -0
- {bitarray-3.7.1 → bitarray-3.8.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bitarray
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.8.0
|
|
4
4
|
Summary: efficient arrays of booleans -- C extension
|
|
5
5
|
Home-page: https://github.com/ilanschnell/bitarray
|
|
6
6
|
Author: Ilan Schnell
|
|
@@ -19,6 +19,8 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: Free Threading :: 1 - Unstable
|
|
22
24
|
Classifier: Topic :: Utilities
|
|
23
25
|
License-File: LICENSE
|
|
24
26
|
Dynamic: author
|
|
@@ -76,7 +78,7 @@ Key features
|
|
|
76
78
|
Installation
|
|
77
79
|
------------
|
|
78
80
|
|
|
79
|
-
Python wheels are are available on PyPI for all
|
|
81
|
+
Python wheels are are available on PyPI for all major platforms and Python
|
|
80
82
|
versions. Which means you can simply:
|
|
81
83
|
|
|
82
84
|
.. code-block:: shell-session
|
|
@@ -89,7 +91,7 @@ Once you have installed the package, you may want to test it:
|
|
|
89
91
|
|
|
90
92
|
$ python -c 'import bitarray; bitarray.test()'
|
|
91
93
|
bitarray is installed in: /Users/ilan/bitarray/bitarray
|
|
92
|
-
bitarray version: 3.
|
|
94
|
+
bitarray version: 3.8.0
|
|
93
95
|
sys.version: 3.13.5 (main, Jun 16 2025) [Clang 18.1.8]
|
|
94
96
|
sys.prefix: /Users/ilan/miniforge
|
|
95
97
|
pointer size: 64 bit
|
|
@@ -98,13 +100,14 @@ Once you have installed the package, you may want to test it:
|
|
|
98
100
|
HAVE_BUILTIN_BSWAP64: 1
|
|
99
101
|
default bit-endianness: big
|
|
100
102
|
machine byte-order: little
|
|
103
|
+
Py_GIL_DISABLED: 0
|
|
101
104
|
Py_DEBUG: 0
|
|
102
105
|
DEBUG: 0
|
|
103
106
|
.........................................................................
|
|
104
107
|
.........................................................................
|
|
105
108
|
................................................................
|
|
106
109
|
----------------------------------------------------------------------
|
|
107
|
-
Ran
|
|
110
|
+
Ran 595 tests in 0.165s
|
|
108
111
|
|
|
109
112
|
OK
|
|
110
113
|
|
|
@@ -351,7 +354,7 @@ and can therefore be used as a dictionary key:
|
|
|
351
354
|
Reference
|
|
352
355
|
=========
|
|
353
356
|
|
|
354
|
-
bitarray version: 3.
|
|
357
|
+
bitarray version: 3.8.0 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
|
|
355
358
|
|
|
356
359
|
In the following, ``item`` and ``value`` are usually a single bit -
|
|
357
360
|
an integer 0 or 1.
|
|
@@ -587,6 +590,7 @@ bitarray methods:
|
|
|
587
590
|
|
|
588
591
|
``tobytes()`` -> bytes
|
|
589
592
|
Return the bitarray buffer (pad bits are set to zero).
|
|
593
|
+
``a.tobytes()`` is equivalent to ``bytes(a)``
|
|
590
594
|
|
|
591
595
|
|
|
592
596
|
``tofile(f, /)``
|
|
@@ -657,8 +661,6 @@ Functions defined in the `bitarray` module:
|
|
|
657
661
|
|
|
658
662
|
``get_default_endian()`` -> str
|
|
659
663
|
Return the default bit-endianness for new bitarray objects being created.
|
|
660
|
-
Unless ``_set_default_endian('little')`` was called, the default
|
|
661
|
-
bit-endianness is ``big``.
|
|
662
664
|
|
|
663
665
|
New in version 1.3
|
|
664
666
|
|
|
@@ -729,6 +731,11 @@ This sub-module was added in version 1.2.
|
|
|
729
731
|
Also, ``a`` may be any object that exposes a writable buffer.
|
|
730
732
|
Nothing about this function is specific to bitarray objects.
|
|
731
733
|
|
|
734
|
+
We should mention that Python's ``array.array`` object has a
|
|
735
|
+
method ``.byteswap()`` with similar functionality. However, unlike
|
|
736
|
+
bitarray's ``util.byteswap()`` function, this method is limited to
|
|
737
|
+
swapping 2, 4, or 8 consecutive bytes.
|
|
738
|
+
|
|
732
739
|
New in version 3.4
|
|
733
740
|
|
|
734
741
|
|
|
@@ -870,11 +877,7 @@ This sub-module was added in version 1.2.
|
|
|
870
877
|
set to one. Mathematically equivalent to setting (in a bitarray of
|
|
871
878
|
length ``n``) all bits at indices ``random.sample(range(n), k)`` to one.
|
|
872
879
|
The random bitarrays are reproducible when giving Python's ``random.seed()``
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
This function requires Python 3.9 or higher, as it depends on the standard
|
|
876
|
-
library function ``random.randbytes()``. Raises ``NotImplementedError``
|
|
877
|
-
when Python version is too low.
|
|
880
|
+
a specific seed value.
|
|
878
881
|
|
|
879
882
|
New in version 3.6
|
|
880
883
|
|
|
@@ -44,7 +44,7 @@ Key features
|
|
|
44
44
|
Installation
|
|
45
45
|
------------
|
|
46
46
|
|
|
47
|
-
Python wheels are are available on PyPI for all
|
|
47
|
+
Python wheels are are available on PyPI for all major platforms and Python
|
|
48
48
|
versions. Which means you can simply:
|
|
49
49
|
|
|
50
50
|
.. code-block:: shell-session
|
|
@@ -57,7 +57,7 @@ Once you have installed the package, you may want to test it:
|
|
|
57
57
|
|
|
58
58
|
$ python -c 'import bitarray; bitarray.test()'
|
|
59
59
|
bitarray is installed in: /Users/ilan/bitarray/bitarray
|
|
60
|
-
bitarray version: 3.
|
|
60
|
+
bitarray version: 3.8.0
|
|
61
61
|
sys.version: 3.13.5 (main, Jun 16 2025) [Clang 18.1.8]
|
|
62
62
|
sys.prefix: /Users/ilan/miniforge
|
|
63
63
|
pointer size: 64 bit
|
|
@@ -66,13 +66,14 @@ Once you have installed the package, you may want to test it:
|
|
|
66
66
|
HAVE_BUILTIN_BSWAP64: 1
|
|
67
67
|
default bit-endianness: big
|
|
68
68
|
machine byte-order: little
|
|
69
|
+
Py_GIL_DISABLED: 0
|
|
69
70
|
Py_DEBUG: 0
|
|
70
71
|
DEBUG: 0
|
|
71
72
|
.........................................................................
|
|
72
73
|
.........................................................................
|
|
73
74
|
................................................................
|
|
74
75
|
----------------------------------------------------------------------
|
|
75
|
-
Ran
|
|
76
|
+
Ran 595 tests in 0.165s
|
|
76
77
|
|
|
77
78
|
OK
|
|
78
79
|
|
|
@@ -319,7 +320,7 @@ and can therefore be used as a dictionary key:
|
|
|
319
320
|
Reference
|
|
320
321
|
=========
|
|
321
322
|
|
|
322
|
-
bitarray version: 3.
|
|
323
|
+
bitarray version: 3.8.0 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
|
|
323
324
|
|
|
324
325
|
In the following, ``item`` and ``value`` are usually a single bit -
|
|
325
326
|
an integer 0 or 1.
|
|
@@ -555,6 +556,7 @@ bitarray methods:
|
|
|
555
556
|
|
|
556
557
|
``tobytes()`` -> bytes
|
|
557
558
|
Return the bitarray buffer (pad bits are set to zero).
|
|
559
|
+
``a.tobytes()`` is equivalent to ``bytes(a)``
|
|
558
560
|
|
|
559
561
|
|
|
560
562
|
``tofile(f, /)``
|
|
@@ -625,8 +627,6 @@ Functions defined in the `bitarray` module:
|
|
|
625
627
|
|
|
626
628
|
``get_default_endian()`` -> str
|
|
627
629
|
Return the default bit-endianness for new bitarray objects being created.
|
|
628
|
-
Unless ``_set_default_endian('little')`` was called, the default
|
|
629
|
-
bit-endianness is ``big``.
|
|
630
630
|
|
|
631
631
|
New in version 1.3
|
|
632
632
|
|
|
@@ -697,6 +697,11 @@ This sub-module was added in version 1.2.
|
|
|
697
697
|
Also, ``a`` may be any object that exposes a writable buffer.
|
|
698
698
|
Nothing about this function is specific to bitarray objects.
|
|
699
699
|
|
|
700
|
+
We should mention that Python's ``array.array`` object has a
|
|
701
|
+
method ``.byteswap()`` with similar functionality. However, unlike
|
|
702
|
+
bitarray's ``util.byteswap()`` function, this method is limited to
|
|
703
|
+
swapping 2, 4, or 8 consecutive bytes.
|
|
704
|
+
|
|
700
705
|
New in version 3.4
|
|
701
706
|
|
|
702
707
|
|
|
@@ -838,11 +843,7 @@ This sub-module was added in version 1.2.
|
|
|
838
843
|
set to one. Mathematically equivalent to setting (in a bitarray of
|
|
839
844
|
length ``n``) all bits at indices ``random.sample(range(n), k)`` to one.
|
|
840
845
|
The random bitarrays are reproducible when giving Python's ``random.seed()``
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
This function requires Python 3.9 or higher, as it depends on the standard
|
|
844
|
-
library function ``random.randbytes()``. Raises ``NotImplementedError``
|
|
845
|
-
when Python version is too low.
|
|
846
|
+
a specific seed value.
|
|
846
847
|
|
|
847
848
|
New in version 3.6
|
|
848
849
|
|
|
@@ -9,14 +9,12 @@ Please find a description of this package at:
|
|
|
9
9
|
|
|
10
10
|
Author: Ilan Schnell
|
|
11
11
|
"""
|
|
12
|
-
from __future__ import absolute_import
|
|
13
12
|
from collections import namedtuple
|
|
14
13
|
|
|
15
|
-
from bitarray._bitarray import (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
from bitarray._bitarray import (
|
|
15
|
+
bitarray, decodetree, bits2bytes, _bitarray_reconstructor,
|
|
16
|
+
get_default_endian, _sysinfo, BITARRAY_VERSION as __version__
|
|
17
|
+
)
|
|
20
18
|
|
|
21
19
|
__all__ = ['bitarray', 'frozenbitarray', 'decodetree', 'bits2bytes']
|
|
22
20
|
|
|
@@ -162,7 +162,6 @@ __version__: str
|
|
|
162
162
|
def bits2bytes(n: int) -> int: ...
|
|
163
163
|
def get_default_endian() -> str: ...
|
|
164
164
|
def test(verbosity: int = ...) -> TextTestResult: ...
|
|
165
|
-
def _set_default_endian(endian: str) -> None: ...
|
|
166
165
|
def _sysinfo(key: str) -> int: ...
|
|
167
166
|
def _bitarray_reconstructor(cls: type,
|
|
168
167
|
buffer: bytes,
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
/* size used when reading / writing blocks from files (in bytes) */
|
|
17
17
|
#define BLOCKSIZE 65536
|
|
18
18
|
|
|
19
|
-
/* default bit-endianness */
|
|
20
|
-
static int default_endian = ENDIAN_BIG;
|
|
21
|
-
|
|
22
19
|
/* translation table - setup during module initialization */
|
|
23
20
|
static char reverse_trans[256];
|
|
24
21
|
|
|
@@ -1323,9 +1320,8 @@ bitarray_invert(bitarrayobject *self, PyObject *args)
|
|
|
1323
1320
|
return NULL;
|
|
1324
1321
|
}
|
|
1325
1322
|
self->ob_item[i / 8] ^= BITMASK(self, i);
|
|
1326
|
-
Py_RETURN_NONE;
|
|
1327
1323
|
}
|
|
1328
|
-
if (PySlice_Check(arg)) {
|
|
1324
|
+
else if (PySlice_Check(arg)) {
|
|
1329
1325
|
Py_ssize_t start, stop, step, slicelength;
|
|
1330
1326
|
|
|
1331
1327
|
if (PySlice_GetIndicesEx(arg, self->nbits,
|
|
@@ -1333,15 +1329,15 @@ bitarray_invert(bitarrayobject *self, PyObject *args)
|
|
|
1333
1329
|
return NULL;
|
|
1334
1330
|
adjust_step_positive(slicelength, &start, &stop, &step);
|
|
1335
1331
|
invert_range(self, start, stop, step);
|
|
1336
|
-
Py_RETURN_NONE;
|
|
1337
1332
|
}
|
|
1338
|
-
if (arg == Py_None) {
|
|
1333
|
+
else if (arg == Py_None) {
|
|
1339
1334
|
invert_span(self, 0, self->nbits);
|
|
1340
|
-
Py_RETURN_NONE;
|
|
1341
1335
|
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1336
|
+
else {
|
|
1337
|
+
return PyErr_Format(PyExc_TypeError, "index expect, not '%s' object",
|
|
1338
|
+
Py_TYPE(arg)->tp_name);
|
|
1339
|
+
}
|
|
1340
|
+
Py_RETURN_NONE;
|
|
1345
1341
|
}
|
|
1346
1342
|
|
|
1347
1343
|
PyDoc_STRVAR(invert_doc,
|
|
@@ -1577,7 +1573,8 @@ bitarray_tobytes(bitarrayobject *self)
|
|
|
1577
1573
|
PyDoc_STRVAR(tobytes_doc,
|
|
1578
1574
|
"tobytes() -> bytes\n\
|
|
1579
1575
|
\n\
|
|
1580
|
-
Return the bitarray buffer (pad bits are set to zero)
|
|
1576
|
+
Return the bitarray buffer (pad bits are set to zero).\n\
|
|
1577
|
+
`a.tobytes()` is equivalent to `bytes(a)`");
|
|
1581
1578
|
|
|
1582
1579
|
|
|
1583
1580
|
/* Extend self with bytes from f.read(n). Return number of bytes actually
|
|
@@ -3117,7 +3114,7 @@ decodetree_todict(decodetreeobject *self)
|
|
|
3117
3114
|
if ((dict = PyDict_New()) == NULL)
|
|
3118
3115
|
return NULL;
|
|
3119
3116
|
|
|
3120
|
-
prefix = newbitarrayobject(&Bitarray_Type, 0,
|
|
3117
|
+
prefix = newbitarrayobject(&Bitarray_Type, 0, ENDIAN_DEFAULT);
|
|
3121
3118
|
if (prefix == NULL)
|
|
3122
3119
|
goto error;
|
|
3123
3120
|
|
|
@@ -3566,6 +3563,8 @@ static PyMethodDef bitarray_methods[] = {
|
|
|
3566
3563
|
to01_doc},
|
|
3567
3564
|
{"tobytes", (PyCFunction) bitarray_tobytes, METH_NOARGS,
|
|
3568
3565
|
tobytes_doc},
|
|
3566
|
+
{"__bytes__", (PyCFunction) bitarray_tobytes, METH_NOARGS,
|
|
3567
|
+
tobytes_doc},
|
|
3569
3568
|
{"tofile", (PyCFunction) bitarray_tofile, METH_O,
|
|
3570
3569
|
tofile_doc},
|
|
3571
3570
|
{"tolist", (PyCFunction) bitarray_tolist, METH_NOARGS,
|
|
@@ -3601,10 +3600,8 @@ static PyMethodDef bitarray_methods[] = {
|
|
|
3601
3600
|
static int
|
|
3602
3601
|
endian_from_string(const char *str)
|
|
3603
3602
|
{
|
|
3604
|
-
assert(default_endian == ENDIAN_LITTLE || default_endian == ENDIAN_BIG);
|
|
3605
|
-
|
|
3606
3603
|
if (str == NULL)
|
|
3607
|
-
return
|
|
3604
|
+
return ENDIAN_DEFAULT;
|
|
3608
3605
|
|
|
3609
3606
|
if (strcmp(str, "little") == 0)
|
|
3610
3607
|
return ENDIAN_LITTLE;
|
|
@@ -3613,7 +3610,7 @@ endian_from_string(const char *str)
|
|
|
3613
3610
|
return ENDIAN_BIG;
|
|
3614
3611
|
|
|
3615
3612
|
PyErr_Format(PyExc_ValueError, "bit-endianness must be either "
|
|
3616
|
-
|
|
3613
|
+
"'little' or 'big', not '%s'", str);
|
|
3617
3614
|
return -1;
|
|
3618
3615
|
}
|
|
3619
3616
|
|
|
@@ -4127,39 +4124,13 @@ reconstructor(PyObject *module, PyObject *args)
|
|
|
4127
4124
|
static PyObject *
|
|
4128
4125
|
get_default_endian(PyObject *module)
|
|
4129
4126
|
{
|
|
4130
|
-
return PyUnicode_FromString(ENDIAN_STR(
|
|
4127
|
+
return PyUnicode_FromString(ENDIAN_STR(ENDIAN_DEFAULT));
|
|
4131
4128
|
}
|
|
4132
4129
|
|
|
4133
4130
|
PyDoc_STRVAR(get_default_endian_doc,
|
|
4134
4131
|
"get_default_endian() -> str\n\
|
|
4135
4132
|
\n\
|
|
4136
|
-
Return the default bit-endianness for new bitarray objects being created
|
|
4137
|
-
Unless `_set_default_endian('little')` was called, the default\n\
|
|
4138
|
-
bit-endianness is `big`.");
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
static PyObject *
|
|
4142
|
-
set_default_endian(PyObject *module, PyObject *args)
|
|
4143
|
-
{
|
|
4144
|
-
char *endian_str;
|
|
4145
|
-
int t;
|
|
4146
|
-
|
|
4147
|
-
if (!PyArg_ParseTuple(args, "s:_set_default_endian", &endian_str))
|
|
4148
|
-
return NULL;
|
|
4149
|
-
|
|
4150
|
-
/* As endian_from_string() might return -1, we have to store its value
|
|
4151
|
-
in a temporary variable before setting default_endian. */
|
|
4152
|
-
if ((t = endian_from_string(endian_str)) < 0)
|
|
4153
|
-
return NULL;
|
|
4154
|
-
default_endian = t;
|
|
4155
|
-
|
|
4156
|
-
Py_RETURN_NONE;
|
|
4157
|
-
}
|
|
4158
|
-
|
|
4159
|
-
PyDoc_STRVAR(set_default_endian_doc,
|
|
4160
|
-
"_set_default_endian(endian, /)\n\
|
|
4161
|
-
\n\
|
|
4162
|
-
Set the default bit-endianness for new bitarray objects being created.");
|
|
4133
|
+
Return the default bit-endianness for new bitarray objects being created.");
|
|
4163
4134
|
|
|
4164
4135
|
|
|
4165
4136
|
static PyObject *
|
|
@@ -4182,6 +4153,11 @@ sysinfo(PyObject *module, PyObject *args)
|
|
|
4182
4153
|
R("PY_LITTLE_ENDIAN", PY_LITTLE_ENDIAN);
|
|
4183
4154
|
R("PY_BIG_ENDIAN", PY_BIG_ENDIAN);
|
|
4184
4155
|
R("HAVE_BUILTIN_BSWAP64", HAVE_BUILTIN_BSWAP64);
|
|
4156
|
+
#ifdef Py_GIL_DISABLED /* Python configured using --disable-gil */
|
|
4157
|
+
R("Py_GIL_DISABLED", 1);
|
|
4158
|
+
#else
|
|
4159
|
+
R("Py_GIL_DISABLED", 0);
|
|
4160
|
+
#endif
|
|
4185
4161
|
#ifdef Py_DEBUG /* Python configured using --with-pydebug */
|
|
4186
4162
|
R("Py_DEBUG", 1);
|
|
4187
4163
|
#else
|
|
@@ -4193,7 +4169,8 @@ sysinfo(PyObject *module, PyObject *args)
|
|
|
4193
4169
|
R("DEBUG", 0);
|
|
4194
4170
|
#endif
|
|
4195
4171
|
|
|
4196
|
-
|
|
4172
|
+
PyErr_SetString(PyExc_KeyError, key);
|
|
4173
|
+
return NULL;
|
|
4197
4174
|
#undef R
|
|
4198
4175
|
}
|
|
4199
4176
|
|
|
@@ -4211,8 +4188,6 @@ static PyMethodDef module_functions[] = {
|
|
|
4211
4188
|
reduce_doc},
|
|
4212
4189
|
{"get_default_endian", (PyCFunction) get_default_endian, METH_NOARGS,
|
|
4213
4190
|
get_default_endian_doc},
|
|
4214
|
-
{"_set_default_endian", (PyCFunction) set_default_endian, METH_VARARGS,
|
|
4215
|
-
set_default_endian_doc},
|
|
4216
4191
|
{"_sysinfo", (PyCFunction) sysinfo, METH_VARARGS,
|
|
4217
4192
|
sysinfo_doc},
|
|
4218
4193
|
{NULL, NULL} /* sentinel */
|
|
@@ -4260,6 +4235,10 @@ PyInit__bitarray(void)
|
|
|
4260
4235
|
if ((m = PyModule_Create(&moduledef)) == NULL)
|
|
4261
4236
|
return NULL;
|
|
4262
4237
|
|
|
4238
|
+
#ifdef Py_GIL_DISABLED
|
|
4239
|
+
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
|
4240
|
+
#endif
|
|
4241
|
+
|
|
4263
4242
|
if (PyType_Ready(&Bitarray_Type) < 0)
|
|
4264
4243
|
return NULL;
|
|
4265
4244
|
Py_SET_TYPE(&Bitarray_Type, &PyType_Type);
|
|
@@ -4287,8 +4266,8 @@ PyInit__bitarray(void)
|
|
|
4287
4266
|
return NULL;
|
|
4288
4267
|
Py_SET_TYPE(&SearchIter_Type, &PyType_Type);
|
|
4289
4268
|
|
|
4290
|
-
|
|
4291
|
-
|
|
4269
|
+
if (PyModule_AddStringMacro(m, BITARRAY_VERSION) < 0)
|
|
4270
|
+
return NULL;
|
|
4292
4271
|
|
|
4293
4272
|
return m;
|
|
4294
4273
|
}
|
|
@@ -2249,12 +2249,17 @@ PyInit__util(void)
|
|
|
2249
2249
|
if ((m = PyModule_Create(&moduledef)) == NULL)
|
|
2250
2250
|
return NULL;
|
|
2251
2251
|
|
|
2252
|
+
#ifdef Py_GIL_DISABLED
|
|
2253
|
+
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
|
2254
|
+
#endif
|
|
2255
|
+
|
|
2252
2256
|
if (PyType_Ready(&CHDI_Type) < 0)
|
|
2253
2257
|
return NULL;
|
|
2254
2258
|
Py_SET_TYPE(&CHDI_Type, &PyType_Type);
|
|
2255
2259
|
|
|
2256
2260
|
#ifndef NDEBUG /* expose segment size in debug mode for testing */
|
|
2257
|
-
|
|
2261
|
+
if (PyModule_AddIntConstant(m, "_SEGSIZE", SEGSIZE) < 0)
|
|
2262
|
+
return NULL;
|
|
2258
2263
|
#endif
|
|
2259
2264
|
|
|
2260
2265
|
return m;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Author: Ilan Schnell
|
|
6
6
|
*/
|
|
7
|
-
#define BITARRAY_VERSION "3.
|
|
7
|
+
#define BITARRAY_VERSION "3.8.0"
|
|
8
8
|
|
|
9
9
|
#ifdef STDC_HEADERS
|
|
10
10
|
# include <stddef.h>
|
|
@@ -52,6 +52,8 @@ typedef struct {
|
|
|
52
52
|
/* --- bit-endianness --- */
|
|
53
53
|
#define ENDIAN_LITTLE 0
|
|
54
54
|
#define ENDIAN_BIG 1
|
|
55
|
+
/* default bit-endianness */
|
|
56
|
+
#define ENDIAN_DEFAULT ENDIAN_BIG
|
|
55
57
|
|
|
56
58
|
#define IS_LE(self) ((self)->endian == ENDIAN_LITTLE)
|
|
57
59
|
#define IS_BE(self) ((self)->endian == ENDIAN_BIG)
|
|
@@ -233,7 +235,7 @@ setup_table(char *table, char kop)
|
|
|
233
235
|
for (k = 0; k < 256; k++) {
|
|
234
236
|
char t = 0, j;
|
|
235
237
|
for (j = 0; j < 8; j++) {
|
|
236
|
-
if (k & 1 << j)
|
|
238
|
+
if (k & 1 << j) {
|
|
237
239
|
/* j are the indices of active bits in k (little endian) */
|
|
238
240
|
switch (kop) {
|
|
239
241
|
case 'a': t += j; break; /* add active indices */
|
|
@@ -249,6 +251,7 @@ setup_table(char *table, char kop)
|
|
|
249
251
|
case 'r': t |= 128 >> j; break; /* reverse bits */
|
|
250
252
|
default: Py_UNREACHABLE();
|
|
251
253
|
}
|
|
254
|
+
}
|
|
252
255
|
}
|
|
253
256
|
table[k] = t;
|
|
254
257
|
}
|