[pypy-svn] pypy bytearray: (lac, mfoord) bytearray.join and decode operations work again

mfoord commits-noreply at bitbucket.org
Thu Jan 20 16:54:20 CET 2011


Author: Michael Foord <michael at voidspace.org.uk>
Branch: bytearray
Changeset: r41046:9adc015588a4
Date: 2011-01-20 16:40 +0100
http://bitbucket.org/pypy/pypy/changeset/9adc015588a4/

Log:	(lac, mfoord) bytearray.join and decode operations work again

diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -345,14 +345,18 @@
                 space.w_TypeError,
                 "sequence item %d: expected string, %s "
                 "found", i, space.type(w_s).getname(space, '?'))
-        reslen += len(space.str_w(w_s))
+        reslen += len(space.bufferstr_w(w_s))
     newdata = []
     for i in range(len(list_w)):
         if data and i != 0:
             newdata.extend(data)
-        newdata.extend([c for c in space.str_w(list_w[i])])
+        newdata.extend([c for c in space.bufferstr_w(list_w[i])])
     return W_BytearrayObject(newdata)
 
+def str_decode__Bytearray_ANY_ANY(space, w_bytearray, w_encoding, w_errors):
+    w_str = str__Bytearray(space, w_bytearray)
+    return stringobject.str_decode__String_ANY_ANY(space, w_str, w_encoding, w_errors)
+
 def str_islower__Bytearray(space, w_bytearray):
     w_str = str__Bytearray(space, w_bytearray)
     return stringobject.str_islower__String(space, w_str)


More information about the Pypy-commit mailing list