Author vstinner
Recipients belopolsky, pitrou, terry.reedy, tjollans, vstinner
Date 2010-07-01.02:30:15
SpamBayes Score 0.000842207
Marked as misclassified No
Message-id <1277951420.01.0.164184159322.issue8990@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-07-01 02:30:20vstinnersetrecipients: + vstinner, terry.reedy, belopolsky, pitrou, tjollans
2010-07-01 02:30:20vstinnersetmessageid: <1277951420.01.0.164184159322.issue8990@psf.upfronthosting.co.za>
2010-07-01 02:30:17vstinnerlinkissue8990 messages
2010-07-01 02:30:15vstinnercreate