Issue #1717, continued:  remove PyObject_Compare and Py_CmpToRich declarations
from object.h; don't inherit tp_compare slot on subclasses; and raise TypeError
when initializing a type that has a nonzero tp_compare slot.  Fix up
comparison-related comments in object.c and code.h.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 3f1df8d..c6d6fc8 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3662,7 +3662,7 @@
 		type->tp_setattr = base->tp_setattr;
 		type->tp_setattro = base->tp_setattro;
 	}
-	/* tp_compare see tp_richcompare */
+	/* tp_compare is ignored, see tp_richcompare */
 	COPYSLOT(tp_repr);
 	/* tp_hash see tp_richcompare */
 	COPYSLOT(tp_call);
@@ -3670,12 +3670,10 @@
 	{
 		/* Copy comparison-related slots only when
 		   not overriding them anywhere */
-		if (type->tp_compare == NULL &&
-		    type->tp_richcompare == NULL &&
+		if (type->tp_richcompare == NULL &&
 		    type->tp_hash == NULL &&
 		    !overrides_hash(type))
 		{
-			type->tp_compare = base->tp_compare;
 			type->tp_richcompare = base->tp_richcompare;
 			type->tp_hash = base->tp_hash;
 		}
@@ -3888,6 +3886,13 @@
 			goto error;
 	}
 
+	/* Check reserved slots */
+	if (type->tp_compare) {
+		PyErr_Format(PyExc_TypeError,
+			     "type %s has tp_compare",
+			     type->tp_name);
+	}
+
 	/* All done -- set the ready flag */
 	assert(type->tp_dict != NULL);
 	type->tp_flags =