[pypy-svn] pypy fast-forward: (jacob, michael) Second argument to bytearray.translate now supported
mfoord
commits-noreply at bitbucket.org
Sun Jan 16 19:26:56 CET 2011
Author: Michael Foord <michael at voidspace.org.uk>
Branch: fast-forward
Changeset: r40734:e794b797d388
Date: 2011-01-16 19:18 +0100
http://bitbucket.org/pypy/pypy/changeset/e794b797d388/
Log: (jacob, michael) Second argument to bytearray.translate now
supported
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
@@ -160,8 +160,8 @@
def str_translate__Bytearray_Bytearray_String(space, w_bytearray1, w_bytearray2, w_str):
# XXX slow, copies *twice* needs proper implementation
- w_str = delegate_Bytearray2String(space, w_bytearray1)
- w_res = space.call_method(w_str, 'translate', w_bytearray2)
+ w_str_copy = delegate_Bytearray2String(space, w_bytearray1)
+ w_res = space.call_method(w_str_copy, 'translate', w_bytearray2, w_str)
return String2Bytearray(space, w_res)
# Mostly copied from repr__String, but without the "smart quote"
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
@@ -63,7 +63,7 @@
c = ba.translate(rosetta, 'l')
assert c == bytearray('hee')
- assert typeof(c) is bytearray
+ assert isinstance(c, bytearray)
def test_iter(self):
assert list(bytearray('hello')) == [104, 101, 108, 108, 111]
More information about the Pypy-commit
mailing list