[pypy-svn] pypy default: (fenrrir) bytearray += unicode should raise TypeError
amauryfa
commits-noreply at bitbucket.org
Wed Jan 26 19:27:37 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch:
Changeset: r41370:5f95e402d44f
Date: 2011-01-26 19:25 +0100
http://bitbucket.org/pypy/pypy/changeset/5f95e402d44f/
Log: (fenrrir) bytearray += unicode should raise TypeError
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
@@ -592,7 +592,7 @@
return w_bytearray1
def inplace_add__Bytearray_ANY(space, w_bytearray1, w_iterable2):
- list_extend__Bytearray_ANY(space, w_bytearray1, w_iterable2)
+ w_bytearray1.data += space.bufferstr_new_w(w_iterable2)
return w_bytearray1
def setitem__Bytearray_ANY_ANY(space, w_bytearray, w_index, w_item):
diff --git a/pypy/objspace/std/test/test_bytes.py b/pypy/objspace/std/test/test_bytes.py
--- a/pypy/objspace/std/test/test_bytes.py
+++ b/pypy/objspace/std/test/test_bytes.py
@@ -314,6 +314,7 @@
b += 'def'
assert b == 'abcdef'
assert isinstance(b, bytearray)
+ raises(TypeError, b.__iadd__, u"")
def test_add(self):
b1 = bytearray("abc")
More information about the Pypy-commit
mailing list