gh-104922: Make PY_SSIZE_T_CLEAN not mandatory again (#105051)

This commit is contained in:
Inada Naoki 2023-05-31 18:38:55 +09:00 committed by GitHub
parent f90d3f68db
commit adccff3b3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 105 additions and 397 deletions

View file

@ -901,23 +901,6 @@ class String_TestCase(unittest.TestCase):
self.assertRaises(TypeError, getargs_s_hash, memoryview(b'memoryview'))
self.assertRaises(TypeError, getargs_s_hash, None)
def test_s_hash_int(self):
# "s#" without PY_SSIZE_T_CLEAN defined.
from _testcapi import getargs_s_hash_int
from _testcapi import getargs_s_hash_int2
buf = bytearray([1, 2])
self.assertRaises(SystemError, getargs_s_hash_int, buf, "abc")
self.assertRaises(SystemError, getargs_s_hash_int, buf, x=42)
self.assertRaises(SystemError, getargs_s_hash_int, buf, x="abc")
self.assertRaises(SystemError, getargs_s_hash_int2, buf, ("abc",))
self.assertRaises(SystemError, getargs_s_hash_int2, buf, x=42)
self.assertRaises(SystemError, getargs_s_hash_int2, buf, x="abc")
buf.append(3) # still mutable -- not locked by a buffer export
# getargs_s_hash_int(buf) may not raise SystemError because skipitem()
# is not called. But it is an implementation detail.
# getargs_s_hash_int(buf)
# getargs_s_hash_int2(buf)
def test_z(self):
from _testcapi import getargs_z
self.assertEqual(getargs_z('abc\xe9'), b'abc\xc3\xa9')