[pypy-svn] r79437 - in pypy/branch/fast-forward/pypy/objspace/std: . test
afa at codespeak.net
afa at codespeak.net
Tue Nov 23 23:43:41 CET 2010
Author: afa
Date: Tue Nov 23 23:43:38 2010
New Revision: 79437
Modified:
pypy/branch/fast-forward/pypy/objspace/std/bytearrayobject.py
pypy/branch/fast-forward/pypy/objspace/std/test/test_bytes.py
Log:
bytearray.extend shoud accept any buffer object
Modified: pypy/branch/fast-forward/pypy/objspace/std/bytearrayobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/bytearrayobject.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/bytearrayobject.py Tue Nov 23 23:43:38 2010
@@ -365,7 +365,7 @@
w_bytearray.data += w_other.data
def list_extend__Bytearray_ANY(space, w_bytearray, w_other):
- w_bytearray.data += [c for c in space.str_w(w_other)]
+ w_bytearray.data += [c for c in space.bufferstr_w(w_other)]
def inplace_add__Bytearray_Bytearray(space, w_bytearray1, w_bytearray2):
list_extend__Bytearray_Bytearray(space, w_bytearray1, w_bytearray2)
Modified: pypy/branch/fast-forward/pypy/objspace/std/test/test_bytes.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/test/test_bytes.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/test/test_bytes.py Tue Nov 23 23:43:38 2010
@@ -154,6 +154,8 @@
b.extend(bytearray('def'))
b.extend('ghi')
assert b == 'abcdefghi'
+ b.extend(buffer('jkl'))
+ assert b == 'abcdefghijkl'
def test_delslice(self):
b = bytearray('abcdefghi')
More information about the Pypy-commit
mailing list