diff options
author | Georg Brandl <georg@python.org> | 2006-07-26 08:03:10 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-07-26 08:03:10 (GMT) |
commit | 5f135787ec4040bfbeb16f2944086028635151db (patch) | |
tree | a7db166102d100e0d6e77fca48573772b88fb8ce /Lib/test | |
parent | 0619a329e822641dff088d9141a7885da882369c (diff) | |
download | cpython-5f135787ec4040bfbeb16f2944086028635151db.zip cpython-5f135787ec4040bfbeb16f2944086028635151db.tar.gz cpython-5f135787ec4040bfbeb16f2944086028635151db.tar.bz2 |
Part of bug #1523610: fix miscalculation of buffer length.
Also add a guard against NULL in converttuple and add a test case
(that previously would have crashed).
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_getargs2.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py index 10481b0..0d9cbd6 100644 --- a/Lib/test/test_getargs2.py +++ b/Lib/test/test_getargs2.py @@ -233,8 +233,25 @@ class LongLong_TestCase(unittest.TestCase): self.failUnlessEqual(VERY_LARGE & ULLONG_MAX, getargs_K(VERY_LARGE)) + +class Tuple_TestCase(unittest.TestCase): + def test_tuple(self): + from _testcapi import getargs_tuple + + ret = getargs_tuple(1, (2, 3)) + self.assertEquals(ret, (1,2,3)) + + # make sure invalid tuple arguments are handled correctly + class seq: + def __len__(self): + return 2 + def __getitem__(self, n): + raise ValueError + self.assertRaises(TypeError, getargs_tuple, 1, seq()) + + def test_main(): - tests = [Signed_TestCase, Unsigned_TestCase] + tests = [Signed_TestCase, Unsigned_TestCase, Tuple_TestCase] try: from _testcapi import getargs_L, getargs_K except ImportError: |