diff options
author | Georg Brandl <georg@python.org> | 2009-07-22 11:57:15 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-07-22 11:57:15 (GMT) |
commit | ec812caf5dd4c8e49c24341852181cca1740277e (patch) | |
tree | 78787b408a873de22de418837dc471dee818b0ae /Lib | |
parent | af2406f21598c136980cebac6e7e9ecdc353ded6 (diff) | |
download | cpython-ec812caf5dd4c8e49c24341852181cca1740277e.zip cpython-ec812caf5dd4c8e49c24341852181cca1740277e.tar.gz cpython-ec812caf5dd4c8e49c24341852181cca1740277e.tar.bz2 |
Issue #6540: Fixed crash for bytearray.translate() with invalid parameters.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_builtin.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 80e1b81..0555616 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1472,6 +1472,11 @@ class BuiltinTest(unittest.TestCase): self.assertEqual(bin(-(2**65)), '-0b1' + '0' * 65) self.assertEqual(bin(-(2**65-1)), '-0b' + '1' * 65) + def test_bytearray_translate(self): + x = bytearray("abc") + self.assertRaises(ValueError, x.translate, "1", 1) + self.assertRaises(TypeError, x.translate, "1"*256, 1) + class TestSorted(unittest.TestCase): def test_basic(self): |