[Jython-checkins] jython: Removed comparison shortcuts to match CPython semantics (__cmp__() must always

alex.gronholm jython-checkins at python.org
Sun Oct 28 20:53:30 CET 2012


http://hg.python.org/jython/rev/68630396061e
changeset:   6879:68630396061e
user:        Alex Grönholm <alex.gronholm at nextday.fi>
date:        Sun Oct 28 21:44:16 2012 +0200
summary:
  Removed comparison shortcuts to match CPython semantics (__cmp__() must always be called if present, even if the two objects are the same!)

files:
  src/org/python/core/PyObject.java |  8 --------
  1 files changed, 0 insertions(+), 8 deletions(-)


diff --git a/src/org/python/core/PyObject.java b/src/org/python/core/PyObject.java
--- a/src/org/python/core/PyObject.java
+++ b/src/org/python/core/PyObject.java
@@ -1350,10 +1350,6 @@
     }
 
     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;
@@ -1366,10 +1362,6 @@
      *  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;

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list