mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-40943: Fix skipitem() didn't raise SystemError (GH-25937)
`convertitem()` raises `SystemError` when '#' is used without `PY_SSIZE_T_CLEAN`. This commit makes `skipitem()` raise it too.
This commit is contained in:
parent
ee8e7c2fa9
commit
4ebf4a6bfa
3 changed files with 32 additions and 11 deletions
|
@ -874,6 +874,13 @@ 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
|
||||
self.assertRaises(SystemError, getargs_s_hash_int, "abc")
|
||||
self.assertRaises(SystemError, getargs_s_hash_int, x=42)
|
||||
# getargs_s_hash_int() don't raise SystemError because skipitem() is not called.
|
||||
|
||||
def test_z(self):
|
||||
from _testcapi import getargs_z
|
||||
self.assertEqual(getargs_z('abc\xe9'), b'abc\xc3\xa9')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue