Michael Foord avatar Michael Foord committed e794b79

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

Comments (0)

Files changed (2)


 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"


             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]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.