Antoine Pitrou <[email protected]> added the comment:

Here is a patch. A static empty string is used in case PyByteArray_AS_STRING() 
is asked on an empty bytearray, instead of returning NULL.

Another possibility would be to implement tp_new for bytearray and always 
allocate a new 1-byte string, but this would make the patch slightly more 
complicated.

(the patch also removes "nullstring", which was unused since Florent's recent 
patches)

----------
Added file: http://bugs.python.org/file15924/bytearray.patch

_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7561>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to