summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2021-05-07 02:56:48 (GMT)
committerGitHub <noreply@github.com>2021-05-07 02:56:48 (GMT)
commit4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0 (patch)
treec704af6585b785b39027b73bf0675d92b52845bb /Lib/test
parentee8e7c2fa950f88ba2c33035bea7aed7aaf0cb77 (diff)
downloadcpython-4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0.zip
cpython-4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0.tar.gz
cpython-4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0.tar.bz2
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.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_getargs2.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index c67e6f5..e0db9e4 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -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')