Commits

Alex Grönholm committed 6863039

Removed comparison shortcuts to match CPython semantics (__cmp__() must always be called if present, even if the two objects are the same!)

Comments (0)

Files changed (1)

src/org/python/core/PyObject.java

     }
 
     private final int _cmp_unsafe(PyObject other) {
-        // Shortcut for equal objects
-        if (this == other)
-            return 0;
-
         int result = _try__cmp__(other);
         if (result != -2) {
             return result;
      *  thus it avoids to invoke _default_cmp.
      */
     private final int _cmpeq_unsafe(PyObject other) {
-        // Shortcut for equal objects
-        if (this == other)
-            return 0;
-
         int result = _try__cmp__(other);
         if (result != -2) {
             return result;