summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getargs2.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-19 18:57:59 (GMT)
committerGitHub <noreply@github.com>2022-07-19 18:57:59 (GMT)
commit31a390e43f2ea2608c5ec04de7d012df14f16fda (patch)
tree8060611d89a8455b79c1beb04e27bb65e8239f60 /Lib/test/test_getargs2.py
parent374afb4a4e93d3faafcf1d08fcd650d8ee8798ca (diff)
downloadcpython-31a390e43f2ea2608c5ec04de7d012df14f16fda.zip
cpython-31a390e43f2ea2608c5ec04de7d012df14f16fda.tar.gz
cpython-31a390e43f2ea2608c5ec04de7d012df14f16fda.tar.bz2
[3.10] gh-94930: skipitem() in getargs.c should return non-NULL on error (GH-94931) (GH-94963)
(cherry picked from commit 067f0da33506f70c36a67d5f3d8d011c8dae10c9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_getargs2.py')
-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 571cabb..fd1952c 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -878,9 +878,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