summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-07-18 15:07:31 (GMT)
committerGitHub <noreply@github.com>2022-07-18 15:07:31 (GMT)
commit067f0da33506f70c36a67d5f3d8d011c8dae10c9 (patch)
treec6cf952e26949902479d7729af9da92acdf0ba38 /Lib
parent2f8bff6879c5d76d143068e8bc867196a7d28afc (diff)
downloadcpython-067f0da33506f70c36a67d5f3d8d011c8dae10c9.zip
cpython-067f0da33506f70c36a67d5f3d8d011c8dae10c9.tar.gz
cpython-067f0da33506f70c36a67d5f3d8d011c8dae10c9.tar.bz2
gh-94930: skipitem() in getargs.c should return non-NULL on error (GH-94931)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_getargs2.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 7c11c6c..899e546 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -877,9 +877,19 @@ class String_TestCase(unittest.TestCase):
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.
+ 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