mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Merged revisions 77573 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77573 | antoine.pitrou | 2010-01-17 13:26:20 +0100 (dim., 17 janv. 2010) | 6 lines Issue #7561: Operations on empty bytearrays (such as `int(bytearray())`) could crash in many places because of the PyByteArray_AS_STRING() macro returning NULL. The macro now returns a statically allocated empty string instead. ........
This commit is contained in:
parent
1119a64916
commit
fc8d6f4b73
4 changed files with 21 additions and 15 deletions
|
@ -817,6 +817,14 @@ class ByteArrayTest(BaseBytesTest):
|
|||
self.assertRaises(BufferError, delslice)
|
||||
self.assertEquals(b, orig)
|
||||
|
||||
def test_empty_bytearray(self):
|
||||
# Issue #7561: operations on empty bytearrays could crash in many
|
||||
# situations, due to a fragile implementation of the
|
||||
# PyByteArray_AS_STRING() C macro.
|
||||
self.assertRaises(ValueError, int, bytearray(b''))
|
||||
self.assertRaises((ValueError, OSError), os.mkdir, bytearray(b''))
|
||||
|
||||
|
||||
class AssortedBytesTest(unittest.TestCase):
|
||||
#
|
||||
# Test various combinations of bytes and bytearray
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue