[pypy-svn] r79901 - pypy/branch/fast-forward/pypy/objspace/std

agaynor at codespeak.net agaynor at codespeak.net
Wed Dec 8 17:18:35 CET 2010


Author: agaynor
Date: Wed Dec  8 17:18:34 2010
New Revision: 79901

Modified:
   pypy/branch/fast-forward/pypy/objspace/std/ropeobject.py
Log:
Fixed ropeobject tests.


Modified: pypy/branch/fast-forward/pypy/objspace/std/ropeobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/ropeobject.py	(original)
+++ pypy/branch/fast-forward/pypy/objspace/std/ropeobject.py	Wed Dec  8 17:18:34 2010
@@ -15,7 +15,7 @@
 
 from pypy.rlib import rope
 from pypy.objspace.std.stringobject import mod__String_ANY as mod__Rope_ANY,\
-    _upper, _lower
+    _upper, _lower, DEFAULT_NOOP_TABLE
 
 class W_RopeObject(W_Object):
     from pypy.objspace.std.stringtype import str_typedef as typedef
@@ -830,11 +830,14 @@
     which must be a string of length 256"""
 
     # XXX CPython accepts buffers, too, not sure what we should do
-    table = space.str_w(w_table)
-    if len(table) != 256:
-        raise OperationError(
-            space.w_ValueError,
-            space.wrap("translation table must be 256 characters long"))
+    if space.is_w(w_table, space.w_None):
+        table = DEFAULT_NOOP_TABLE
+    else:
+        table = space.str_w(w_table)
+        if len(table) != 256:
+            raise OperationError(
+                space.w_ValueError,
+                space.wrap("translation table must be 256 characters long"))
 
     node = w_string._node
     chars = []



More information about the Pypy-commit mailing list