Author: Manuel Jacob
Branch: remove-tuple-smm
Changeset: r64424:f9d3d3fb8ad9
Date: 2013-05-22 10:16 +0200
http://bitbucket.org/pypy/pypy/changeset/f9d3d3fb8ad9/

Log:    Add a non-specialized code path to W_SpecialisedTupleObject's
        descr_eq().

diff --git a/pypy/objspace/std/specialisedtupleobject.py 
b/pypy/objspace/std/specialisedtupleobject.py
--- a/pypy/objspace/std/specialisedtupleobject.py
+++ b/pypy/objspace/std/specialisedtupleobject.py
@@ -74,9 +74,23 @@
             return space.wrap(intmask(x))
 
         def descr_eq(self, space, w_other):
+            if not isinstance(w_other, W_AbstractTupleObject):
+                return space.w_NotImplementedError
             if not isinstance(w_other, cls):
-                # if we are not comparing same types, give up
-                return space.w_NotImplemented
+                if nValues != w_other.length():
+                    return space.w_False
+                for i in iter_n:
+                    myval    = getattr(self,    'value%s' % i)
+                    otherval = w_other.getitem(space, i)
+                    if typetuple[i] == object:
+                        myval_wrapped = myval
+                    else:
+                        myval_wrapped = space.wrap(myval)
+                    if not space.eq_w(myval_wrapped, otherval):
+                        return space.w_False
+                else:
+                    return space.w_True
+
             for i in iter_n:
                 myval    = getattr(self,    'value%s' % i)
                 otherval = getattr(w_other, 'value%s' % i)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to