-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
BitArray.{slice_bits,slice_shots,__getitem__}
raise `IndexErro…
…r` when indices are not valid (backport #12755) (#12844) * Make `BitArray.{slice_bits,slice_shots,__getitem__}` raise `IndexError` when indices are not valid (#12755) * Make BitArray.{slice_bits,slice_shots} raise IndexError when indices are out of bounds * update __getitem__ (cherry picked from commit bfd2eea) # Conflicts: # qiskit/primitives/containers/bit_array.py * Update bit_array.py --------- Co-authored-by: Takashi Imamichi <[email protected]> Co-authored-by: Elena Peña Tapia <[email protected]>
- Loading branch information
1 parent
f97a620
commit 4f09f57
Showing
3 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
releasenotes/notes/fix-bitarray-slice-bits-shots-c9cb7e5d907722f5.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
upgrade_primitives: | ||
- | | ||
:meth:`.BitArray.slice_bits` and :meth:`.BitArray.slice_shots` | ||
will now raise ``IndexError`` when indices are out of bounds. | ||
They used to raise ``ValueError`` in the case. | ||
- | | ||
:meth:`.BitArray.__getitem__` will now raise ``IndexError`` | ||
when indices are out of bounds or the number of dimensions | ||
of indices does not match that of BitArray. | ||
They used to raise ``ValueError`` in the case. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters