diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-12-13 11:14:44 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-12-13 11:14:44 (GMT) |
commit | c9362cf86ae302e89207dff7206b1c6bba413e33 (patch) | |
tree | c531a5e1bb121292cfdd16a2ff956f6586825a0e /Lib/test/test_bytes.py | |
parent | 3ad2d70947a1b6c4b76c2029213e654c1b6ebc4e (diff) | |
download | cpython-c9362cf86ae302e89207dff7206b1c6bba413e33.zip cpython-c9362cf86ae302e89207dff7206b1c6bba413e33.tar.gz cpython-c9362cf86ae302e89207dff7206b1c6bba413e33.tar.bz2 |
Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c"
argument is not in range [0; 255].
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r-- | Lib/test/test_bytes.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index 3520e83..3c09141 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -729,6 +729,12 @@ class BytesTest(BaseBytesTest, unittest.TestCase): self.assertEqual(PyBytes_FromFormat(b's:%s', c_char_p(b'cstr')), b's:cstr') + # Issue #19969 + self.assertRaises(OverflowError, + PyBytes_FromFormat, b'%c', c_int(-1)) + self.assertRaises(OverflowError, + PyBytes_FromFormat, b'%c', c_int(256)) + class ByteArrayTest(BaseBytesTest, unittest.TestCase): type2test = bytearray |