Thomas Jollans <tho...@jollans.com> added the comment:

Thanks for the input. I'm going to re-work the patch a bit (releasing buffers 
and such) and add a test within the next few days. 

The question remains whether or not to accept other buffers with itemsize == 1. 
The way I understand it, fromstring already accepted any read-only buffer 
object, no matter the item size / whether it actually makes sense to call it a 
"string". I don't think accepting a hypothetical read-only buffer with items 
wider than 1 in fromstring (yes, bad naming) is desirable behaviour - I see a 
few options on how to deal with input validation:

1. ignore the item size. This'd be similar to current behaviour, plus r/w 
buffers

2. only accept byte-based buffers. ("things that look like 'const char*'") - 
this is what I've been aiming at.

3. only accept bytes and bytearray, and let the user think about how to deal 
with other objects. Question is - shouldn't array('B') be treated like 
bytearray in this respect?

----------

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

Reply via email to