summaryrefslogtreecommitdiff
path: root/Lib/test/test_buffer.py
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2020-03-12 19:35:38 +0100
committerGitHub <noreply@github.com>2020-03-12 19:35:38 +0100
commit1ae9cde4b2323235b5f9ff4bc76e4175a2257172 (patch)
tree4ed231a4a962389f5f0e6d5101632d6524f6c691 /Lib/test/test_buffer.py
parentfdcd53fe1a8a7f052d7217c36b2597df06b6e016 (diff)
downloadcpython-git-1ae9cde4b2323235b5f9ff4bc76e4175a2257172.tar.gz
bpo-39689: Do not test undefined casts to _Bool (GH-18964)
- When casting to _Bool, arrays should only contain zeros or ones.
Diffstat (limited to 'Lib/test/test_buffer.py')
-rw-r--r--Lib/test/test_buffer.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
index 2ddca06b8b..d440bcf7e0 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -2754,6 +2754,10 @@ class TestBufferProtocol(unittest.TestCase):
# be 1D, at least one format must be 'c', 'b' or 'B'.
for _tshape in gencastshapes():
for char in fmtdict['@']:
+ # Casts to _Bool are undefined if the source contains values
+ # other than 0 or 1.
+ if char == "?":
+ continue
tfmt = ('', '@')[randrange(2)] + char
tsize = struct.calcsize(tfmt)
n = prod(_tshape) * tsize