Serhiy Storchaka added the comment:

The bytearray object allocates one byte more for trailing null byte. ob_size 
always should be less than ob_alloc if ob_alloc != 0. But in rare cases when 
the bytearray is initialized with an iterator, this rule can be violated. 
Following patch restores this property. PyByteArray_AS_STRING() now always 
returns null-terminated string.

----------
Added file: http://bugs.python.org/file39826/bytearray_init_trailing_null.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24467>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to