summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-03-12 18:56:18 (GMT)
committerGitHub <noreply@github.com>2020-03-12 18:56:18 (GMT)
commitf8ce3e2dae277baa2ef92e8a3e935953dc6c3f39 (patch)
treed118780277aba8dac9f7b1030b161da4ce3231ef /Lib/test
parent35ae5d916c6c2e9f211666a3a97965be3d2977ae (diff)
downloadcpython-f8ce3e2dae277baa2ef92e8a3e935953dc6c3f39.zip
cpython-f8ce3e2dae277baa2ef92e8a3e935953dc6c3f39.tar.gz
cpython-f8ce3e2dae277baa2ef92e8a3e935953dc6c3f39.tar.bz2
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 1ae9cde4b2323235b5f9ff4bc76e4175a2257172) Co-authored-by: Stefan Krah <skrah@bytereef.org>
Diffstat (limited to 'Lib/test')
-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 dd84faf..dcea206 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -2751,6 +2751,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