mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c"
argument is not in range [0; 255].
This commit is contained in:
parent
3ad2d70947
commit
c9362cf86a
3 changed files with 25 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue