[pypy-svn] r48946 - pypy/dist/pypy/objspace/std

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Nov 22 21:29:33 CET 2007


Author: cfbolz
Date: Thu Nov 22 21:29:31 2007
New Revision: 48946

Modified:
   pypy/dist/pypy/objspace/std/ropeobject.py
   pypy/dist/pypy/objspace/std/unicodeobject.py
Log:
fix some tests


Modified: pypy/dist/pypy/objspace/std/ropeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/ropeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/ropeobject.py	Thu Nov 22 21:29:31 2007
@@ -830,7 +830,10 @@
 def str_decode__Rope_ANY_ANY(space, w_string, w_encoding=None, w_errors=None):
     from pypy.objspace.std.unicodetype import _get_encoding_and_errors, \
         getdefaultencoding
-    from pypy.objspace.std.ropeunicodeobject import decode_string
+    if space.config.objspace.std.withropeunicode:
+        from pypy.objspace.std.ropeunicodeobject import decode_string
+    else:
+        from pypy.objspace.std.unicodetype import decode_object as decode_string
     encoding, errors = _get_encoding_and_errors(space, w_encoding, w_errors)
     if encoding is None:
         encoding = getdefaultencoding(space)

Modified: pypy/dist/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/unicodeobject.py	Thu Nov 22 21:29:31 2007
@@ -771,7 +771,7 @@
         return space.newtuple([w_unistr, W_UnicodeObject.EMPTY,
                                W_UnicodeObject.EMPTY])
     else:
-        assert pos > 0
+        assert pos >= 0
         return space.newtuple([space.wrap(unistr[:pos]), w_unisub,
                                space.wrap(unistr[pos+len(unisub):])])
 
@@ -786,7 +786,7 @@
         return space.newtuple([W_UnicodeObject.EMPTY,
                                W_UnicodeObject.EMPTY, w_unistr])
     else:
-        assert pos > 0
+        assert pos >= 0
         return space.newtuple([space.wrap(unistr[:pos]), w_unisub,
                                space.wrap(unistr[pos+len(unisub):])])
 



More information about the Pypy-commit mailing list