STINNER Victor <victor.stin...@haypocalc.com> added the comment:

array2.diff:
 - can you reindent the line "Py_ssize_t old_size = Py_SIZE(self);"?(even if 
it's not part of your patch)
 - you can avoid the "char *str;" variable (use directly buffer.buf)

--

> I changed "s#" to "y*". This means that str arguments are no longer
> accepted by fromstring (...) it is an incompatible change

It's maybe time to create .frombytes() and .tobytes() methods:

 - .tostring() will be a (deprecated?) alias to .tobytes()
 - .frombytes() only accepts bytes, bytearray and buffer compatible objects: 
use "y*" format
 - .fromstring() accepts str, bytes, bytearray and buffer compatible objects 
(encode str to utf-8): use "s*" format

But I still don't understand why array.fromstring() accepts character strings. 
So an easier solution is to apply array2.diff to Python 3.2, and replace "y*" 
by "s*" when the patch is applied to 3.1.

----------

_______________________________________
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