[pypy-commit] lang-smalltalk default: try to improve byteobject comparisons

timfel noreply at buildbot.pypy.org
Fri Feb 7 09:55:35 CET 2014


Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch: 
Changeset: r597:4830ce6194cb
Date: 2014-02-05 10:15 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/4830ce6194cb/

Log:	try to improve byteobject comparisons

diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -796,13 +796,15 @@
         return True
 
     def is_same_object(self, other):
+        if self is other:
+            return True
         # XXX this sounds very wrong to me
-        if not isinstance(other, W_BytesObject):
+        elif not isinstance(other, W_BytesObject):
             return False
         size = self.size()
         if size != other.size():
             return False
-        if size > 256 and self.bytes is not None and other.bytes is not None:
+        elif size > 256 and self.bytes is not None and other.bytes is not None:
             return self.bytes == other.bytes
         else:
             return self.has_same_chars(other, size)


More information about the pypy-commit mailing list