Commits

Michael Foord  committed e794b79

(jacob, michael) Second argument to bytearray.translate now supported

  • Participants
  • Parent commits acab350
  • Branches fast-forward

Comments (0)

Files changed (2)

File pypy/objspace/std/bytearrayobject.py

 
 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"

File pypy/objspace/std/test/test_bytes.py

             
             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]