NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #942 most downloaded on PyPI
efficient arrays of booleans -- C extension
Latest stable
3.12.5
Last release 2 days ago
02 Dec 2026
Release timing varies
gaps range from 9 days to 5 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
18 years old
131 releases · first in 2008
Drag across the ruler to compare, or tap a release to open it.
Fixed bug for big-endian systems (such as IBM s390), see #159 and #160
zip_safe=False to setup(), see #151Fix util.ba2int() for frozenbitarrays. A bug was introduced in 2.3.0 as .tobytes() no longer treats pad bits for read-only buffers as zero.
util.ba2int() for frozenbitarrays. A bug was introduced in 2.3.0
as .tobytes() no longer treats pad bits for read-only buffers as zero.
* improve some error messages * add tests
Your coding agent can read these notes before it upgrades. Set up the MCP server →
fix slice assignment for shared buffer with offset case, see #3ba05687 and #73081e98
buffers_overlap())fix special shared buffer copy case, see #815c2a11
add optional buffer argument to bitarray() to import the buffer of another object, #141, #146, see also: buffer protocol
buffer argument to bitarray() to import the buffer of
another object, #141, #146, see also: buffer protocol
.buffer_info() to include: a read-only flag, an imported buffer
flag, and the number of buffer exportsutil.rindex()_) in string input, e.g. bitarray('1100_0111').bytereverse() arguments.extend() type annotations, #145.reverse() using temporary memory.unpack(), util.serialize(), util.vl_encode()
and .__reduce__() more memory efficientspeedup find_bit() and find_last() using uint64 checking, this means a speedup for .find(), .index(), .search() and util.rindex()
find_bit() and find_last() using uint64 checking, this means
a speedup for .find(), .index(), .search() and util.rindex()
.bytereverse()use shift operations to speedup all unaligned copy operations, #142
optimize slice assignment with negative step, e.g.: a[::-1] = 1
repeat(), #136
a[::-1] = 1speedup slice assignment, see #132 and #135
getbit() and setbit() in bitarray.hbitarray.h: make getbit() always an (inline) function
vl_encode()bitarray.h: make getbit() always an (inline) functionadd bitarray.util.vl_encode() and bitarray.util.vl_decode() which uses a variable length bitarray format, #131
bitarray.util.vl_encode() and bitarray.util.vl_decode() which
uses a variable length bitarray format, #131Fix building with MSVC / Bullseye, #129
support type hinting for all Python 3 versions (that bitarray supports, 3.5 and higher currently), fixed #128
add type hinting (see PEP 484, 561) using stub (.pyi) files
.pyi) files
.find(), .index(), .search() and .itersearch() now all except both (sub-) bitarray as well as bool items to be searched for
.find() method, see #122
.find(), .index(), .search() and .itersearch() now all except
both (sub-) bitarray as well as bool items to be searched for* update documentation * improve some error messages
remove .length() method (deprecated since 1.5.1 - use len())
.length() method (deprecated since 1.5.1 - use len()).unpack() the one argument now defaults to 0x01 (was 0xff).tolist() now always returns a list of integers (0 or 1)<<= and >>=.extend() (and bitarray creation)util.int2ba()update pythoncapi_compat: Fix support with PyPy 3.7, #120
switch documentation from markdown to reStructuredText
add shift operations (<<, >>, <<=, >>=), see #117
<<, >>, <<=, >>=), see #117
bitarray.util.ba2base() and bitarray.util.base2ba(),
see last paragraph in Bitarray representationsfix crash caused by unsupported types in binary operations, #116
bitarray.util.pprint()moved implementation of and hex2ba() and ba2hex() to C-level
hex2ba() and ba2hex() to C-level
bitarray.util.parity()add bitarray.util.serialize() and bitarray.util.deserialize()
bitarray.util.serialize() and bitarray.util.deserialize()
\n\r\t\v) in input strings,
e.g. bitarray('01 11') or a += '10 00'bitarray.util.pprint()a = bitarray('110', 'little') and b = bitarray(a, 'big'),
the buffer used to be simply copied, with consequence that a == b would
result in False. This is fixed now, that is a == b will always
evaluate to True.fix issue #114, raise TypeError when incorrect index is used during assignment, e.g. a[1.5] = 1
a[1.5] = 1
a[1:4] = 1.2raise TypeError when trying to extend bitarrays from bytes on Python 3, i.e. bitarray(b'011') and .extend(b'110'). (Deprecated since 1.4.1)
bitarray.util.urandom()
bitarray(b'011') and .extend(b'110'). (Deprecated since 1.4.1)add missing .h files to sdist tarball, #113
use Py_SET_TYPE() and Py_SET_SIZE() for Python 3.10, #109
Py_SET_TYPE() and Py_SET_SIZE() for Python 3.10, #109
a[2::] = a or a[::-1] = a, #112use PyType_Ready for all types: bitarray, bitarrayiterator, decodeiterator, decodetree, searchiterator
remove deprecated bitdiff(), which has been deprecated since version 1.2.0, use bitarray.util.count_xor() instead
decodetree object, for speeding up consecutive calls
to .decode() and .iterdecode(), in particular when dealing
with large prefix codes, see #103
.tolist() which changes the items in the
returned list to integers (0 or 1), as opposed to Booleansbitdiff(), which has been deprecated since version
1.2.0, use bitarray.util.count_xor() insteadadd optional index parameter to .index() to invert single bit
.index() to invert single bit
sys.getsizeof(bitarray) by adding .__sizeof__(), see issue #100add PyType_Ready usage, issue #66
deprecate .length() in favor of len()
util.ba2int() and util.int2ba(),
see issue #85
.length() in favor of len()Use Py_ssize_t for bitarray index. This means that on 32bit systems, the maximum number of elements in a bitarray is 2 GBits. We used to have a specia
Py_ssize_t for bitarray index. This means that on 32bit
systems, the maximum number of elements in a bitarray is 2 GBits.
We used to have a special 64bit index type for all architectures, but
this prevented us from using Python's sequence, mapping and number
methods, and made those method lookups slow.
&, |, ^, &=, |=, ^=.
This should have always been the case but was overlooked in the past.fix memory leak in ~ operation (bitarray_cpinvert)
~ operation (bitarray_cpinvert)add DeprecationWarning for bitdiff()
bitdiff()bitarray(b'011') and .extend(b'110')).fromfile() and .tofile() implementation,
such that now the same code is used for Python 2 and 3.
The new implementation is more memory efficient on
Python 3.memcmp() in richcompare() to shortcut EQ/NE, when
comparing two very large bitarrays for equality the
speedup can easily be 100xadd .clear() method (Python 3.3 added this method to lists)
.clear() method (Python 3.3 added this method to lists)
NotImplementedError with (useful message) when trying to call
the .fromstring() or .tostring() methods, which have been removed
in the last releaseremove .fromstring() and .tostring() methods, these have been deprecated 8 years ago, since version 0.4.0
bitarray.util.make_endian()
util.ba2hex() and util.hex2ba() now also support little-endianbitarray.get_default_endian().fromstring() and .tostring() methods, these have been
deprecated 8 years ago, since version 0.4.0__all__ in bitarray/__init__.pyutil.ba2hex() now always return a string object (instead of bytes object for Python 3), see issue #94
util.ba2hex() now always return a string object (instead of bytes
object for Python 3), see issue #94
util.hex2ba allows a unicode object as input on Python 2simplify markdown of readme so PyPI renders better
deprecate bitarray.bitdiff() in favor of bitarray.util.count_xor()
bitarray.bitdiff() in favor of bitarray.util.count_xor().count() on 32bit systems in special cases when array size
is 2^29 bits or largerfix issue #68, unittest.TestCase.assert_ deprecated
.count() methodsetrange() (C-function) by using memset()unittest.TestCase.assert_ deprecated* fix readme to pass twine check
twine checkfix bitarrays beings created from unicode in Python 2
PyBytes_* in C code, treating the Py3k function names as default,
which also removes all redefinitions of PyString_*refactor resize() - only shrink allocated memory if new size falls lower than half the allocated size
fix to compile on Windows with VS 2015, issue #72
fix types to actually be types, #29
more efficient decode and iterdecode by using C-level binary tree instead of a python one, #54
add exception to setup.py when README.rst cannot be opened
add official Python 3.6 support (although it was already working)
fill(), #52copy_n(): fast copy with memmove() fixed, #43fix issue #10, i.e. int(bitarray()) segfault
int(bitarray()) segfault
add (module level) function bitdiff for calculating the difference between two bitarrays
add iterdecode method (C level), which returns an iterator but is otherwise like the decode method
add buffer protocol to bitarray objects (Python 2.7 only)
a[::3] = 0 (in addition to
booleans)__contains__ excepts either booleans or bitarraysfixed MSVC compile error on Python 3 (thanks to Chris Gohlke)
update documentation to use tobytes and frombytes, rather than tostring and fromstring (which are now deprecated)
minor fixes in docstrings, added more tests
introduced .tobytes() and .frombytes() (.tostring() and .fromstring() are now deprecated)
.tobytes() and .frombytes() (.tostring()
and .fromstring() are now deprecated)added possibility to slice assign to True or False, e.g. a[::3] = True will set every third element to True
True or False,
e.g. a[::3] = True will set every third element to TrueMade C code less ambiguous, such that the package compiles on Visual Studio, with all tests passing.
One column per quarter.