Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 636eecb

Browse files
miss-islingtonStefan Krah
and
Stefan Krah
authored
bpo-39689: Do not test undefined casts to _Bool (GH-18964) (#18965)
- When casting to _Bool, arrays should only contain zeros or ones. (cherry picked from commit 1ae9cde) Co-authored-by: Stefan Krah <[email protected]>
1 parent feaf0c3 commit 636eecb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/test/test_buffer.py

+4
Original file line numberDiff line numberDiff line change
@@ -2730,6 +2730,10 @@ def test_memoryview_cast_1D_ND(self):
27302730
# be 1D, at least one format must be 'c', 'b' or 'B'.
27312731
for _tshape in gencastshapes():
27322732
for char in fmtdict['@']:
2733+
# Casts to _Bool are undefined if the source contains values
2734+
# other than 0 or 1.
2735+
if char == "?":
2736+
continue
27332737
tfmt = ('', '@')[randrange(2)] + char
27342738
tsize = struct.calcsize(tfmt)
27352739
n = prod(_tshape) * tsize

0 commit comments

Comments
 (0)