Author: Philip Jenvey <pjen...@underboss.org>
Branch: refactor-str-types
Changeset: r66313:9a79f1f76a91
Date: 2013-08-25 13:26 -0700
http://bitbucket.org/pypy/pypy/changeset/9a79f1f76a91/

Log:    fix translation? wrap remaining W_StringBufferObject usages w/
        withstrbuf checks

diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -566,49 +566,55 @@
         return space.wrap(StringBuffer(self._value))
 
     def descr_eq(self, space, w_other):
-        from pypy.objspace.std.strbufobject import W_StringBufferObject
-        if isinstance(w_other, W_StringBufferObject):
-            return space.newbool(self._value == w_other.force())
+        if space.config.objspace.std.withstrbuf:
+            from pypy.objspace.std.strbufobject import W_StringBufferObject
+            if isinstance(w_other, W_StringBufferObject):
+                return space.newbool(self._value == w_other.force())
         if not isinstance(w_other, W_BytesObject):
             return space.w_NotImplemented
         return space.newbool(self._value == w_other._value)
 
     def descr_ne(self, space, w_other):
-        from pypy.objspace.std.strbufobject import W_StringBufferObject
-        if isinstance(w_other, W_StringBufferObject):
-            return space.newbool(self._value != w_other.force())
+        if space.config.objspace.std.withstrbuf:
+            from pypy.objspace.std.strbufobject import W_StringBufferObject
+            if isinstance(w_other, W_StringBufferObject):
+                return space.newbool(self._value != w_other.force())
         if not isinstance(w_other, W_BytesObject):
             return space.w_NotImplemented
         return space.newbool(self._value != w_other._value)
 
     def descr_lt(self, space, w_other):
-        from pypy.objspace.std.strbufobject import W_StringBufferObject
-        if isinstance(w_other, W_StringBufferObject):
-            return space.newbool(self._value < w_other.force())
+        if space.config.objspace.std.withstrbuf:
+            from pypy.objspace.std.strbufobject import W_StringBufferObject
+            if isinstance(w_other, W_StringBufferObject):
+                return space.newbool(self._value < w_other.force())
         if not isinstance(w_other, W_BytesObject):
             return space.w_NotImplemented
         return space.newbool(self._value < w_other._value)
 
     def descr_le(self, space, w_other):
-        from pypy.objspace.std.strbufobject import W_StringBufferObject
-        if isinstance(w_other, W_StringBufferObject):
-            return space.newbool(self._value <= w_other.force())
+        if space.config.objspace.std.withstrbuf:
+            from pypy.objspace.std.strbufobject import W_StringBufferObject
+            if isinstance(w_other, W_StringBufferObject):
+                return space.newbool(self._value <= w_other.force())
         if not isinstance(w_other, W_BytesObject):
             return space.w_NotImplemented
         return space.newbool(self._value <= w_other._value)
 
     def descr_gt(self, space, w_other):
-        from pypy.objspace.std.strbufobject import W_StringBufferObject
-        if isinstance(w_other, W_StringBufferObject):
-            return space.newbool(self._value > w_other.force())
+        if space.config.objspace.std.withstrbuf:
+            from pypy.objspace.std.strbufobject import W_StringBufferObject
+            if isinstance(w_other, W_StringBufferObject):
+                return space.newbool(self._value > w_other.force())
         if not isinstance(w_other, W_BytesObject):
             return space.w_NotImplemented
         return space.newbool(self._value > w_other._value)
 
     def descr_ge(self, space, w_other):
-        from pypy.objspace.std.strbufobject import W_StringBufferObject
-        if isinstance(w_other, W_StringBufferObject):
-            return space.newbool(self._value >= w_other.force())
+        if space.config.objspace.std.withstrbuf:
+            from pypy.objspace.std.strbufobject import W_StringBufferObject
+            if isinstance(w_other, W_StringBufferObject):
+                return space.newbool(self._value >= w_other.force())
         if not isinstance(w_other, W_BytesObject):
             return space.w_NotImplemented
         return space.newbool(self._value >= w_other._value)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to