Closed tneele closed 1 year ago
Thank you for reporting this issue. What version of bitarray are you using? While the segfault was a problem, it should have been fixed in a few years ago. Using the latest version 2.8.1 of bitarray, I get:
>>> from bitarray import bitarray
>>> 3 & bitarray('111')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for &: 'int' and 'bitarray.bitarray'
>>> bitarray('111') | 3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'bitarray.bitarray' and 'int'
Note that for the second operation error message if different.
I was able to verify that this bug was introduced in version 1.5.0 (Aug 2020) and fixed in version 1.8.2 (March 2021). This exact issue has actually been raised in #116 (and was fixed in the 1.8.2 release).
Thanks @ilanschnell. For the record, I'm running version 1.6.3, obtained from the Ubuntu package python3-bitarray
. The next Ubuntu release distributes bitarray version 2.8.1, so it should be fixed there.
In the interactive shell of python, I ran the following and obtained a segfault:
According to gdb, this takes place somewhere in the cpython implementation of bitarray:
By the way, swapping the argument just yields a type error: