8000 bpo-39689: Do not test undefined casts to _Bool (GH-18964) (#18966) · python/cpython@f8ce3e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit f8ce3e2

Browse files
miss-islingtonStefan Krah
andauthored
bpo-39689: Do not test undefined casts to _Bool (GH-18964) (#18966)
- When casting to _Bool, arrays should only contain zeros or ones. (cherry picked from commit 1ae9cde) Co-authored-by: Stefan Krah <skrah@bytereef.org>
1 parent 35ae5d9 com
8000
mit f8ce3e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/test/test_buffer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,6 +2751,10 @@ def test_memoryview_cast_1D_ND(self):
27512751
# be 1D, at least one format must be 'c', 'b' or 'B'.
27522752
for _tshape in gencastshapes():
27532753
for char in fmtdict['@']:
2754+
# Casts to _Bool are undefined if the source contains values
2755+
# other than 0 or 1.
2756+
if char == "?":
2757+
continue
27542758
tfmt = ('', '@')[randrange(2)] + char
27552759
tsize = struct.calcsize(tfmt)
27562760
n = prod(_tshape) * tsize

0 commit comments

Comments
 (0)
0