summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_binascii.py
diff options
context:
space:
mode:
authorFurkan Onder <furkanonder@protonmail.com>2023-10-19 22:09:57 (GMT)
committerGitHub <noreply@github.com>2023-10-19 22:09:57 (GMT)
commit9376728ce45191fcc0b908c7487ad7985454537e (patch)
treed99d5d06cb84e92fdf920b45ad3b794321a2cf05 /Lib/test/test_binascii.py
parent677d4bc15e999aa57abe7d23d7fac2c34a6fe0ba (diff)
downloadcpython-9376728ce45191fcc0b908c7487ad7985454537e.zip
cpython-9376728ce45191fcc0b908c7487ad7985454537e.tar.gz
cpython-9376728ce45191fcc0b908c7487ad7985454537e.tar.bz2
gh-67565: Add tests for C-contiguity checks (GH-110951)
Diffstat (limited to 'Lib/test/test_binascii.py')
-rw-r--r--Lib/test/test_binascii.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py
index ef744f6..82dea8a 100644
--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@ -474,6 +474,12 @@ class BinASCIITest(unittest.TestCase):
restored = binascii.a2b_base64(self.type2test(converted))
self.assertConversion(binary, converted, restored, newline=newline)
+ def test_c_contiguity(self):
+ m = memoryview(bytearray(b'noncontig'))
+ noncontig_writable = m[::-2]
+ with self.assertRaises(BufferError):
+ binascii.b2a_hex(noncontig_writable)
+
class ArrayBinASCIITest(BinASCIITest):
def type2test(self, s):