(Merge 3.3) Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if

"%c" argument is not in range [0; 255].
This commit is contained in:
Victor Stinner 2013-12-13 12:15:31 +01:00
commit 507ac3a591
3 changed files with 25 additions and 3 deletions

View file

@ -743,6 +743,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