Index: Python/traceback.c =================================================================== --- Python/traceback.c (Revision 67635) +++ Python/traceback.c (Arbeitskopie) @@ -72,7 +72,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Python/import.c =================================================================== --- Python/import.c (Revision 67635) +++ Python/import.c (Arbeitskopie) @@ -3243,7 +3243,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Python/symtable.c =================================================================== --- Python/symtable.c (Revision 67635) +++ Python/symtable.c (Arbeitskopie) @@ -130,7 +130,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)ste_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Python/Python-ast.c =================================================================== --- Python/Python-ast.c (Revision 67635) +++ Python/Python-ast.c (Arbeitskopie) @@ -479,7 +479,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Python/bltinmodule.c =================================================================== --- Python/bltinmodule.c (Revision 67635) +++ Python/bltinmodule.c (Arbeitskopie) @@ -417,7 +417,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -494,25 +494,6 @@ ; -static PyObject * -builtin_cmp(PyObject *self, PyObject *args) -{ - PyObject *a, *b; - int c; - - if (!PyArg_UnpackTuple(args, "cmp", 2, 2, &a, &b)) - return NULL; - if (PyObject_Cmp(a, b, &c) < 0) - return NULL; - return PyLong_FromLong((long)c); -} - -PyDoc_STRVAR(cmp_doc, -"cmp(x, y) -> integer\n\ -\n\ -Return negative if xy."); - - static char * source_as_string(PyObject *cmd, char *funcname, char *what) { @@ -1037,7 +1018,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2190,7 +2171,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2235,7 +2216,6 @@ {"ascii", builtin_ascii, METH_O, ascii_doc}, {"bin", builtin_bin, METH_O, bin_doc}, {"chr", builtin_chr, METH_VARARGS, chr_doc}, - {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, {"dir", builtin_dir, METH_VARARGS, dir_doc}, Index: Include/unicodeobject.h =================================================================== --- Include/unicodeobject.h (Revision 67635) +++ Include/unicodeobject.h (Arbeitskopie) @@ -152,7 +152,6 @@ # define PyUnicode_AsUnicode PyUnicodeUCS2_AsUnicode # define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS2_AsUnicodeEscapeString # define PyUnicode_AsWideChar PyUnicodeUCS2_AsWideChar -# define PyUnicode_Compare PyUnicodeUCS2_Compare # define PyUnicode_Concat PyUnicodeUCS2_Concat # define PyUnicode_Append PyUnicodeUCS2_Append # define PyUnicode_AppendAndDel PyUnicodeUCS2_AppendAndDel @@ -250,7 +249,6 @@ # define PyUnicode_AsUnicode PyUnicodeUCS4_AsUnicode # define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS4_AsUnicodeEscapeString # define PyUnicode_AsWideChar PyUnicodeUCS4_AsWideChar -# define PyUnicode_Compare PyUnicodeUCS4_Compare # define PyUnicode_Concat PyUnicodeUCS4_Concat # define PyUnicode_Append PyUnicodeUCS4_Append # define PyUnicode_AppendAndDel PyUnicodeUCS4_AppendAndDel @@ -1402,11 +1400,6 @@ /* Compare two strings and return -1, 0, 1 for less than, equal, greater than resp. */ -PyAPI_FUNC(int) PyUnicode_Compare( - PyObject *left, /* Left string */ - PyObject *right /* Right string */ - ); - PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString( PyObject *left, const char *right Index: Include/object.h =================================================================== --- Include/object.h (Revision 67635) +++ Include/object.h (Arbeitskopie) @@ -272,7 +272,7 @@ typedef PyObject *(*getattrofunc)(PyObject *, PyObject *); typedef int (*setattrfunc)(PyObject *, char *, PyObject *); typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *); -typedef int (*cmpfunc)(PyObject *, PyObject *); +//typedef int (*cmpfunc)(PyObject *, PyObject *); typedef PyObject *(*reprfunc)(PyObject *); typedef long (*hashfunc)(PyObject *); typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); @@ -295,7 +295,7 @@ printfunc tp_print; getattrfunc tp_getattr; setattrfunc tp_setattr; - cmpfunc tp_compare; + void *tp_reserved; /* formaly known as tp_compare */ reprfunc tp_repr; /* Method suites for standard classes */ @@ -424,7 +424,7 @@ PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); PyAPI_FUNC(PyObject *) PyObject_ASCII(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Bytes(PyObject *); -PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); +//PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); PyAPI_FUNC(PyObject *) Py_CmpToRich(int op, int cmp); Index: Objects/complexobject.c =================================================================== --- Objects/complexobject.c (Revision 67635) +++ Objects/complexobject.c (Arbeitskopie) @@ -1095,7 +1095,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)complex_repr, /* tp_repr */ &complex_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/codeobject.c =================================================================== --- Objects/codeobject.c (Revision 67635) +++ Objects/codeobject.c (Arbeitskopie) @@ -399,7 +399,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)code_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/abstract.c =================================================================== --- Objects/abstract.c (Revision 67635) +++ Objects/abstract.c (Arbeitskopie) @@ -25,24 +25,6 @@ return NULL; } -/* Operations on any object */ - -int -PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) -{ - int r; - - if (o1 == NULL || o2 == NULL) { - null_error(); - return -1; - } - r = PyObject_Compare(o1, o2); - if (PyErr_Occurred()) - return -1; - *result = r; - return 0; -} - PyObject * PyObject_Type(PyObject *o) { Index: Objects/object.c =================================================================== --- Objects/object.c (Revision 67635) +++ Objects/object.c (Arbeitskopie) @@ -494,24 +494,24 @@ /* The new comparison philosophy is: we completely separate three-way comparison from rich comparison. That is, PyObject_Compare() and - PyObject_Cmp() *just* use the tp_compare slot. And PyObject_RichCompare() + PyObject_Cmp() *just* use the tp_reserved slot. And PyObject_RichCompare() and PyObject_RichCompareBool() *just* use the tp_richcompare slot. See (*) below for practical amendments. - IOW, only cmp() uses tp_compare; the comparison operators (==, !=, <=, <, + IOW, only cmp() uses tp_reserved; the comparison operators (==, !=, <=, <, >=, >) only use tp_richcompare. Note that list.sort() only uses <. - (And yes, eventually we'll rip out cmp() and tp_compare.) + (And yes, eventually we'll rip out cmp() and tp_reserved.) - The calling conventions are different: tp_compare only gets called with two + The calling conventions are different: tp_reserved only gets called with two objects of the appropriate type; tp_richcompare gets called with a first argument of the appropriate type and a second object of an arbitrary type. We never do any kind of coercion. The return conventions are also different. - The tp_compare slot should return a C int, as follows: + The tp_reserved slot should return a C int, as follows: -1 if a < b or if an exception occurred 0 if a == b @@ -541,68 +541,6 @@ */ -/* Forward */ -static PyObject *do_richcompare(PyObject *v, PyObject *w, int op); - -/* Perform a three-way comparison, raising TypeError if three-way comparison - is not supported. */ -static int -do_compare(PyObject *v, PyObject *w) -{ - cmpfunc f; - int ok; - - if (v->ob_type == w->ob_type && - (f = v->ob_type->tp_compare) != NULL) { - return (*f)(v, w); - } - - /* Now try three-way compare before giving up. This is intentionally - elaborate; if you have a it will raise TypeError if it detects two - objects that aren't ordered with respect to each other. */ - ok = PyObject_RichCompareBool(v, w, Py_LT); - if (ok < 0) - return -1; /* Error */ - if (ok) - return -1; /* Less than */ - ok = PyObject_RichCompareBool(v, w, Py_GT); - if (ok < 0) - return -1; /* Error */ - if (ok) - return 1; /* Greater than */ - ok = PyObject_RichCompareBool(v, w, Py_EQ); - if (ok < 0) - return -1; /* Error */ - if (ok) - return 0; /* Equal */ - - /* Give up */ - PyErr_Format(PyExc_TypeError, - "unorderable types: '%.100s' != '%.100s'", - v->ob_type->tp_name, - w->ob_type->tp_name); - return -1; -} - -/* Perform a three-way comparison. This wraps do_compare() with a check for - NULL arguments and a recursion check. */ -int -PyObject_Compare(PyObject *v, PyObject *w) -{ - int res; - - if (v == NULL || w == NULL) { - if (!PyErr_Occurred()) - PyErr_BadInternalCall(); - return -1; - } - if (Py_EnterRecursiveCall(" in cmp")) - return -1; - res = do_compare(v, w); - Py_LeaveRecursiveCall(); - return res < 0 ? -1 : res; -} - /* Map rich comparison operators to their swapped version, e.g. LT <--> GT */ int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE}; @@ -1519,7 +1457,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ none_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -1550,7 +1488,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ NotImplemented_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Objects/cellobject.c =================================================================== --- Objects/cellobject.c (Revision 67635) +++ Objects/cellobject.c (Arbeitskopie) @@ -51,18 +51,6 @@ PyObject_GC_Del(op); } -static int -cell_compare(PyCellObject *a, PyCellObject *b) -{ - if (a->ob_ref == NULL) { - if (b->ob_ref == NULL) - return 0; - return -1; - } else if (b->ob_ref == NULL) - return 1; - return PyObject_Compare(a->ob_ref, b->ob_ref); -} - static PyObject * cell_repr(PyCellObject *op) { @@ -114,7 +102,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)cell_compare, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)cell_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/methodobject.c =================================================================== --- Objects/methodobject.c (Revision 67635) +++ Objects/methodobject.c (Arbeitskopie) @@ -254,7 +254,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)meth_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/typeobject.c =================================================================== --- Objects/typeobject.c (Revision 67635) +++ Objects/typeobject.c (Arbeitskopie) @@ -2584,7 +2584,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)type_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2897,7 +2897,7 @@ slots_a = ((PyHeapTypeObject *)a)->ht_slots; slots_b = ((PyHeapTypeObject *)b)->ht_slots; if (slots_a && slots_b) { - if (PyObject_Compare(slots_a, slots_b) != 0) + if (PyObject_RichCompareBool(slots_a, slots_b, Py_NE) == 1) return 0; size += sizeof(PyObject *) * PyTuple_GET_SIZE(slots_a); } @@ -3357,7 +3357,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ object_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -3663,7 +3663,7 @@ type->tp_setattr = base->tp_setattr; type->tp_setattro = base->tp_setattro; } - /* tp_compare see tp_richcompare */ + /* tp_reserved is ignored, see tp_richcompare */ COPYSLOT(tp_repr); /* tp_hash see tp_richcompare */ COPYSLOT(tp_call); @@ -3671,12 +3671,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; } @@ -3889,6 +3887,13 @@ goto error; } + /* Check reserved slots */ + if (type->tp_reserved) { + PyErr_Format(PyExc_TypeError, + "type %s has tp_reserved", + type->tp_name); + } + /* All done -- set the ready flag */ assert(type->tp_dict != NULL); type->tp_flags = @@ -6252,7 +6257,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ super_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/dictobject.c =================================================================== --- Objects/dictobject.c (Revision 67635) +++ Objects/dictobject.c (Arbeitskopie) @@ -2032,7 +2032,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ &dict_as_sequence, /* tp_as_sequence */ @@ -2217,7 +2217,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2289,7 +2289,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2375,7 +2375,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2682,7 +2682,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ &dictviews_as_number, /* tp_as_number */ &dictkeys_as_sequence, /* tp_as_sequence */ @@ -2766,7 +2766,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ &dictviews_as_number, /* tp_as_number */ &dictitems_as_sequence, /* tp_as_sequence */ @@ -2831,7 +2831,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &dictvalues_as_sequence, /* tp_as_sequence */ Index: Objects/weakrefobject.c =================================================================== --- Objects/weakrefobject.c (Revision 67635) +++ Objects/weakrefobject.c (Arbeitskopie) @@ -342,7 +342,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ (reprfunc)weakref_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -643,7 +643,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)proxy_repr, /* tp_repr */ &proxy_as_number, /* tp_as_number */ &proxy_as_sequence, /* tp_as_sequence */ @@ -676,7 +676,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (unaryfunc)proxy_repr, /* tp_repr */ &proxy_as_number, /* tp_as_number */ &proxy_as_sequence, /* tp_as_sequence */ Index: Objects/tupleobject.c =================================================================== --- Objects/tupleobject.c (Revision 67635) +++ Objects/tupleobject.c (Arbeitskopie) @@ -727,7 +727,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)tuplerepr, /* tp_repr */ 0, /* tp_as_number */ &tuple_as_sequence, /* tp_as_sequence */ @@ -930,7 +930,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/boolobject.c =================================================================== --- Objects/boolobject.c (Revision 67635) +++ Objects/boolobject.c (Arbeitskopie) @@ -139,7 +139,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ bool_repr, /* tp_repr */ &bool_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/rangeobject.c =================================================================== --- Objects/rangeobject.c (Revision 67635) +++ Objects/rangeobject.c (Arbeitskopie) @@ -123,7 +123,7 @@ Algorithm is equal to that of get_len_of_range(), but it operates on PyObjects (which are assumed to be PyLong or PyInt objects). ---------------------------------------------------------------*/ - int cmp_result, cmp_call; + int cmp_result; PyObject *lo, *hi; PyObject *step = NULL; PyObject *diff = NULL; @@ -134,13 +134,11 @@ PyObject *zero = PyLong_FromLong(0); if (zero == NULL) return NULL; - cmp_call = PyObject_Cmp(r->step, zero, &cmp_result); - Py_DECREF(zero); - if (cmp_call == -1) + if ((cmp_result = PyObject_RichCompareBool(r->step, zero, Py_GT)) == -1) { + Py_DECREF(zero); return NULL; - - assert(cmp_result != 0); - if (cmp_result > 0) { + } + if (cmp_result == 1) { lo = r->start; hi = r->stop; step = r->step; @@ -154,7 +152,7 @@ } /* if (lo >= hi), return length of 0. */ - if (PyObject_Compare(lo, hi) >= 0) { + if (PyObject_RichCompareBool(lo, hi, Py_GE) == 1) { Py_XDECREF(step); return PyLong_FromLong(0); } @@ -290,7 +288,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)range_repr, /* tp_repr */ 0, /* tp_as_number */ &range_as_sequence, /* tp_as_sequence */ @@ -386,7 +384,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -538,7 +536,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/descrobject.c =================================================================== --- Objects/descrobject.c (Revision 67635) +++ Objects/descrobject.c (Arbeitskopie) @@ -392,7 +392,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)method_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -430,7 +430,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)method_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -467,7 +467,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)member_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -504,7 +504,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)getset_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -541,7 +541,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)wrapperdescr_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -774,12 +774,6 @@ return 0; } -static int -proxy_compare(proxyobject *v, PyObject *w) -{ - return PyObject_Compare(v->dict, w); -} - static PyObject * proxy_richcompare(proxyobject *v, PyObject *w, int op) { @@ -796,7 +790,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)proxy_compare, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &proxy_as_sequence, /* tp_as_sequence */ @@ -861,15 +855,6 @@ Py_TRASHCAN_SAFE_END(wp) } -static int -wrapper_compare(wrapperobject *a, wrapperobject *b) -{ - if (a->descr == b->descr) - return PyObject_Compare(a->self, b->self); - else - return (a->descr < b->descr) ? -1 : 1; -} - static long wrapper_hash(wrapperobject *wp) { @@ -977,7 +962,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)wrapper_compare, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)wrapper_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1309,7 +1294,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/memoryobject.c =================================================================== --- Objects/memoryobject.c (Revision 67635) +++ Objects/memoryobject.c (Arbeitskopie) @@ -799,7 +799,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)memory_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/genobject.c =================================================================== --- Objects/genobject.c (Revision 67635) +++ Objects/genobject.c (Arbeitskopie) @@ -333,7 +333,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)gen_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/listobject.c =================================================================== --- Objects/listobject.c (Revision 67635) +++ Objects/listobject.c (Arbeitskopie) @@ -1784,7 +1784,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2565,7 +2565,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)list_repr, /* tp_repr */ 0, /* tp_as_number */ &list_as_sequence, /* tp_as_sequence */ @@ -2631,7 +2631,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2753,7 +2753,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/fileobject.c =================================================================== --- Objects/fileobject.c (Revision 67635) +++ Objects/fileobject.c (Arbeitskopie) @@ -490,7 +490,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)stdprinter_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/cobject.c =================================================================== --- Objects/cobject.c (Revision 67635) +++ Objects/cobject.c (Arbeitskopie) @@ -137,7 +137,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Objects/moduleobject.c =================================================================== --- Objects/moduleobject.c (Revision 67635) +++ Objects/moduleobject.c (Arbeitskopie) @@ -377,7 +377,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)module_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/stringlib/string_format.h =================================================================== --- Objects/stringlib/string_format.h (Revision 67635) +++ Objects/stringlib/string_format.h (Arbeitskopie) @@ -1064,7 +1064,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1197,7 +1197,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/bytesobject.c =================================================================== --- Objects/bytesobject.c (Revision 67635) +++ Objects/bytesobject.c (Arbeitskopie) @@ -3094,7 +3094,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)string_repr, /* tp_repr */ 0, /* tp_as_number */ &string_as_sequence, /* tp_as_sequence */ @@ -3428,7 +3428,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/exceptions.c =================================================================== --- Objects/exceptions.c (Revision 67635) +++ Objects/exceptions.c (Arbeitskopie) @@ -320,7 +320,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /* tp_compare; */ + 0, /* tp_reserved; */ (reprfunc)BaseException_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Objects/frameobject.c =================================================================== --- Objects/frameobject.c (Revision 67635) +++ Objects/frameobject.c (Arbeitskopie) @@ -546,7 +546,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/funcobject.c =================================================================== --- Objects/funcobject.c (Revision 67635) +++ Objects/funcobject.c (Arbeitskopie) @@ -659,7 +659,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)func_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -805,7 +805,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -952,7 +952,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/setobject.c =================================================================== --- Objects/setobject.c (Revision 67635) +++ Objects/setobject.c (Arbeitskopie) @@ -869,7 +869,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1816,13 +1816,6 @@ return Py_NotImplemented; } -static int -set_nocmp(PyObject *self, PyObject *other) -{ - PyErr_SetString(PyExc_TypeError, "cannot compare sets using cmp()"); - return -1; -} - static PyObject * set_add(PySetObject *so, PyObject *key) { @@ -2103,7 +2096,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - set_nocmp, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)set_repr, /* tp_repr */ &set_as_number, /* tp_as_number */ &set_as_sequence, /* tp_as_sequence */ @@ -2200,7 +2193,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - set_nocmp, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)set_repr, /* tp_repr */ &frozenset_as_number, /* tp_as_number */ &set_as_sequence, /* tp_as_sequence */ Index: Objects/longobject.c =================================================================== --- Objects/longobject.c (Revision 67635) +++ Objects/longobject.c (Arbeitskopie) @@ -3758,7 +3758,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ long_repr, /* tp_repr */ &long_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/sliceobject.c =================================================================== --- Objects/sliceobject.c (Revision 67635) +++ Objects/sliceobject.c (Arbeitskopie) @@ -31,7 +31,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ ellipsis_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -352,7 +352,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)slice_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/bytearrayobject.c =================================================================== --- Objects/bytearrayobject.c (Revision 67635) +++ Objects/bytearrayobject.c (Arbeitskopie) @@ -3173,7 +3173,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)bytes_repr, /* tp_repr */ 0, /* tp_as_number */ &bytes_as_sequence, /* tp_as_sequence */ @@ -3282,7 +3282,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/iterobject.c =================================================================== --- Objects/iterobject.c (Revision 67635) +++ Objects/iterobject.c (Arbeitskopie) @@ -103,7 +103,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -207,7 +207,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/enumobject.c =================================================================== --- Objects/enumobject.c (Revision 67635) +++ Objects/enumobject.c (Arbeitskopie) @@ -176,7 +176,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -326,7 +326,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/classobject.c =================================================================== --- Objects/classobject.c (Revision 67635) +++ Objects/classobject.c (Arbeitskopie) @@ -348,7 +348,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)method_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -614,7 +614,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)instancemethod_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/floatobject.c =================================================================== --- Objects/floatobject.c (Revision 67635) +++ Objects/floatobject.c (Arbeitskopie) @@ -1825,7 +1825,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)float_repr, /* tp_repr */ &float_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Objects/structseq.c =================================================================== --- Objects/structseq.c (Revision 67635) +++ Objects/structseq.c (Arbeitskopie) @@ -440,7 +440,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)structseq_repr, /* tp_repr */ 0, /* tp_as_number */ &structseq_as_sequence, /* tp_as_sequence */ Index: PC/_subprocess.c =================================================================== --- PC/_subprocess.c (Revision 67635) +++ PC/_subprocess.c (Arbeitskopie) @@ -133,7 +133,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ &sp_handle_as_number, /*tp_as_number */ 0, /*tp_as_sequence */ Index: PC/winreg.c =================================================================== --- PC/winreg.c (Revision 67635) +++ PC/winreg.c (Arbeitskopie) @@ -485,7 +485,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - PyHKEY_compareFunc, /* tp_compare */ + PyHKEY_compareFunc, /* tp_reserved */ 0, /* tp_repr */ &PyHKEY_NumberMethods, /* tp_as_number */ 0, /* tp_as_sequence */ Index: PC/_msi.c =================================================================== --- PC/_msi.c (Revision 67635) +++ PC/_msi.c (Arbeitskopie) @@ -473,7 +473,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -643,7 +643,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -791,7 +791,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -908,7 +908,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Doc/extending/newtypes.rst =================================================================== --- Doc/extending/newtypes.rst (Revision 67635) +++ Doc/extending/newtypes.rst (Arbeitskopie) @@ -80,7 +80,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1233,16 +1233,16 @@ return -1; } -.. XXX tp_compare is dead; need to rewrite for tp_richcompare! +.. XXX tp_reserved is dead; need to rewrite for tp_richcompare! Object Comparison ----------------- :: - cmpfunc tp_compare; + cmpfunc tp_reserved; - The :attr:`tp_compare` handler is called when comparisons are needed and the + The :attr:`tp_reserved` handler is called when comparisons are needed and the object does not implement the specific rich comparison method which matches the requested comparison. (It is always used if defined and the :cfunc:`PyObject_Compare` or :cfunc:`PyObject_Cmp` functions are used, or if @@ -1253,7 +1253,7 @@ greater than, respectively; as of Python 2.2, this is no longer allowed. In the future, other return values may be assigned a different meaning.) - A :attr:`tp_compare` handler may raise an exception. In this case it should + A :attr:`tp_reserved` handler may raise an exception. In this case it should return a negative value. The caller has to test for the exception using :cfunc:`PyErr_Occurred`. @@ -1486,7 +1486,7 @@ In order to learn how to implement any specific method for your new data type, do the following: Download and unpack the Python source distribution. Go the :file:`Objects` directory, then search the C source files for ``tp_`` plus the -function you want (for example, ``tp_compare``). You will find examples of the +function you want (for example, ``tp_reserved``). You will find examples of the function you want to implement. When you need to verify that an object is an instance of the type you are Index: Doc/c-api/object.rst =================================================================== --- Doc/c-api/object.rst (Revision 67635) +++ Doc/c-api/object.rst (Arbeitskopie) @@ -89,27 +89,6 @@ *opid*. -.. cfunction:: int PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) - - .. index:: builtin: cmp - - Compare the values of *o1* and *o2* using a routine provided by *o1*, if one - exists, otherwise with a routine provided by *o2*. The result of the comparison - is returned in *result*. Returns ``-1`` on failure. This is the equivalent of - the Python statement ``result = cmp(o1, o2)``. - - -.. cfunction:: int PyObject_Compare(PyObject *o1, PyObject *o2) - - .. index:: builtin: cmp - - Compare the values of *o1* and *o2* using a routine provided by *o1*, if one - exists, otherwise with a routine provided by *o2*. Returns the result of the - comparison on success. On error, the value returned is undefined; use - :cfunc:`PyErr_Occurred` to detect an error. This is equivalent to the Python - expression ``cmp(o1, o2)``. - - .. cfunction:: PyObject* PyObject_Repr(PyObject *o) .. index:: builtin: repr Index: Doc/c-api/typeobj.rst =================================================================== --- Doc/c-api/typeobj.rst (Revision 67635) +++ Doc/c-api/typeobj.rst (Arbeitskopie) @@ -244,21 +244,11 @@ the subtype's :attr:`tp_setattr` and :attr:`tp_setattro` are both *NULL*. -.. cmember:: cmpfunc PyTypeObject.tp_compare +.. cmember:: void PyTypeObject.tp_reserved - An optional pointer to the three-way comparison function. + Reserved slot, formaly known as tp_compare. - The signature is the same as for :cfunc:`PyObject_Compare`. The function should - return ``1`` if *self* greater than *other*, ``0`` if *self* is equal to - *other*, and ``-1`` if *self* less than *other*. It should return ``-1`` and - set an exception condition when an error occurred during the comparison. - This field is inherited by subtypes together with :attr:`tp_richcompare` and - :attr:`tp_hash`: a subtypes inherits all three of :attr:`tp_compare`, - :attr:`tp_richcompare`, and :attr:`tp_hash` when the subtype's - :attr:`tp_compare`, :attr:`tp_richcompare`, and :attr:`tp_hash` are all *NULL*. - - .. cmember:: reprfunc PyTypeObject.tp_repr .. index:: builtin: repr @@ -329,14 +319,14 @@ the Python level will result in the ``tp_hash`` slot being set to :cfunc:`PyObject_HashNotImplemented`. - When this field is not set, two possibilities exist: if the :attr:`tp_compare` + When this field is not set, two possibilities exist: if the :attr:`tp_reserved` and :attr:`tp_richcompare` fields are both *NULL*, a default hash value based on the object's address is returned; otherwise, a :exc:`TypeError` is raised. This field is inherited by subtypes together with :attr:`tp_richcompare` and - :attr:`tp_compare`: a subtypes inherits all three of :attr:`tp_compare`, + :attr:`tp_reserved`: a subtypes inherits all three of :attr:`tp_reserved`, :attr:`tp_richcompare`, and :attr:`tp_hash`, when the subtype's - :attr:`tp_compare`, :attr:`tp_richcompare` and :attr:`tp_hash` are all *NULL*. + :attr:`tp_reserved`, :attr:`tp_richcompare` and :attr:`tp_hash` are all *NULL*. .. cmember:: ternaryfunc PyTypeObject.tp_call @@ -596,10 +586,10 @@ comparisons makes sense (e.g. ``==`` and ``!=``, but not ``<`` and friends), directly raise :exc:`TypeError` in the rich comparison function. - This field is inherited by subtypes together with :attr:`tp_compare` and - :attr:`tp_hash`: a subtype inherits all three of :attr:`tp_compare`, + This field is inherited by subtypes together with :attr:`tp_reserved` and + :attr:`tp_hash`: a subtype inherits all three of :attr:`tp_reserved`, :attr:`tp_richcompare`, and :attr:`tp_hash`, when the subtype's - :attr:`tp_compare`, :attr:`tp_richcompare`, and :attr:`tp_hash` are all *NULL*. + :attr:`tp_reserved`, :attr:`tp_richcompare`, and :attr:`tp_hash` are all *NULL*. The following constants are defined to be used as the third argument for :attr:`tp_richcompare` and for :cfunc:`PyObject_RichCompare`: Index: Doc/c-api/unicode.rst =================================================================== --- Doc/c-api/unicode.rst (Revision 67635) +++ Doc/c-api/unicode.rst (Arbeitskopie) @@ -863,12 +863,6 @@ occurrences. -.. cfunction:: int PyUnicode_Compare(PyObject *left, PyObject *right) - - Compare two strings and return -1, 0, 1 for less than, equal, and greater than, - respectively. - - .. cfunction:: int PyUnicode_CompareWithASCIIString(PyObject *uni, char *string) Compare a unicode object, *uni*, with *string* and return -1, 0, 1 for less Index: Doc/includes/noddy2.c =================================================================== --- Doc/includes/noddy2.c (Revision 67635) +++ Doc/includes/noddy2.c (Arbeitskopie) @@ -131,7 +131,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Doc/includes/noddy3.c =================================================================== --- Doc/includes/noddy3.c (Revision 67635) +++ Doc/includes/noddy3.c (Arbeitskopie) @@ -184,7 +184,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Doc/includes/noddy4.c =================================================================== --- Doc/includes/noddy4.c (Revision 67635) +++ Doc/includes/noddy4.c (Arbeitskopie) @@ -165,7 +165,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Doc/includes/noddy.c =================================================================== --- Doc/includes/noddy.c (Revision 67635) +++ Doc/includes/noddy.c (Arbeitskopie) @@ -14,7 +14,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Doc/includes/shoddy.c =================================================================== --- Doc/includes/shoddy.c (Revision 67635) +++ Doc/includes/shoddy.c (Arbeitskopie) @@ -39,7 +39,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Doc/includes/typestruct.h =================================================================== --- Doc/includes/typestruct.h (Revision 67635) +++ Doc/includes/typestruct.h (Arbeitskopie) @@ -9,7 +9,7 @@ printfunc tp_print; getattrfunc tp_getattr; setattrfunc tp_setattr; - cmpfunc tp_compare; + cmpfunc tp_reserved; reprfunc tp_repr; /* Method suites for standard classes */ Index: Lib/decimal.py =================================================================== --- Lib/decimal.py (Revision 67635) +++ Lib/decimal.py (Arbeitskopie) @@ -761,9 +761,16 @@ if self > other. This routine is for internal use only.""" if self._is_special or other._is_special: - return cmp(self._isinfinity(), other._isinfinity()) + self_inf = self._isinfinity() + other_inf = other._isinfinity() + if self_inf == other_inf: + return 0 + elif self_inf < other_inf: + return -1 + else: + return 1 - # check for zeros; note that cmp(0, -0) should return 0 + # check for zeros; note that _cmp(0, -0) should return 0 if not self: if not other: return 0 @@ -783,7 +790,12 @@ if self_adjusted == other_adjusted: self_padded = self._int + '0'*(self._exp - other._exp) other_padded = other._int + '0'*(other._exp - self._exp) - return cmp(self_padded, other_padded) * (-1)**self._sign + if self_padded == other_padded: + return 0 + elif self_padded < other_padded: + return -((-1)**self._sign) + else: + return (-1)**self._sign elif self_adjusted > other_adjusted: return (-1)**self._sign else: # self_adjusted < other_adjusted Index: Lib/ctypes/test/test_libc.py =================================================================== --- Lib/ctypes/test/test_libc.py (Revision 67635) +++ Lib/ctypes/test/test_libc.py (Arbeitskopie) @@ -5,6 +5,9 @@ lib = CDLL(_ctypes_test.__file__) +def twcmp(x, y): + return (x > y) - (x < y) + class LibTest(unittest.TestCase): def test_sqrt(self): lib.my_sqrt.argtypes = c_double, @@ -19,7 +22,7 @@ lib.my_qsort.restype = None def sort(a, b): - return cmp(a[0], b[0]) + return twcmp(a[0], b[0]) chars = create_string_buffer("spam, spam, and spam") lib.my_qsort(chars, len(chars)-1, sizeof(c_char), comparefunc(sort)) Index: Lib/unittest.py =================================================================== --- Lib/unittest.py (Revision 67635) +++ Lib/unittest.py (Arbeitskopie) @@ -53,6 +53,7 @@ import traceback import os import types +import operator ############################################################################## # Exported classes and functions @@ -510,7 +511,7 @@ def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): - return mycmp(self.obj, other.obj) == -1 + return not mycmp(self.obj, other.obj) return K class TestLoader: @@ -518,7 +519,7 @@ criteria and returning them wrapped in a TestSuite """ testMethodPrefix = 'test' - sortTestMethodsUsing = cmp + sortTestMethodsUsing = operator.gt suiteClass = TestSuite def loadTestsFromTestCase(self, testCaseClass): @@ -626,13 +627,13 @@ if suiteClass: loader.suiteClass = suiteClass return loader -def getTestCaseNames(testCaseClass, prefix, sortUsing=cmp): +def getTestCaseNames(testCaseClass, prefix, sortUsing=operator.gt): return _makeLoader(prefix, sortUsing).getTestCaseNames(testCaseClass) -def makeSuite(testCaseClass, prefix='test', sortUsing=cmp, suiteClass=TestSuite): +def makeSuite(testCaseClass, prefix='test', sortUsing=operator.gt, suiteClass=TestSuite): return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase(testCaseClass) -def findTestCases(module, prefix='test', sortUsing=cmp, suiteClass=TestSuite): +def findTestCases(module, prefix='test', sortUsing=operator.gt, suiteClass=TestSuite): return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromModule(module) Index: Lib/test/test_set.py =================================================================== --- Lib/test/test_set.py (Revision 67635) +++ Lib/test/test_set.py (Arbeitskopie) @@ -1023,16 +1023,6 @@ result = self.set ^ set([8]) self.assertEqual(result, set([2, 4, 6, 8])) - def test_cmp(self): - a, b = set('a'), set('b') - self.assertRaises(TypeError, cmp, a, b) - - # In py3k, this works! - self.assertRaises(TypeError, cmp, a, a) - - self.assertRaises(TypeError, cmp, a, 12) - self.assertRaises(TypeError, cmp, "abc", a) - #============================================================================== class TestUpdateOps(unittest.TestCase): Index: Lib/test/test_long.py =================================================================== --- Lib/test/test_long.py (Revision 67635) +++ Lib/test/test_long.py (Arbeitskopie) @@ -672,7 +672,8 @@ def _cmp__(self, other): if not isinstance(other, Rat): other = Rat(other) - return cmp(self.n * other.d, self.d * other.n) + x, y = self.n * other.d, self.d * other.n + return (x > y) - (x < y) def __eq__(self, other): return self._cmp__(other) == 0 def __ne__(self, other): @@ -702,8 +703,8 @@ Rx = Rat(x) for y in cases: Ry = Rat(y) - Rcmp = cmp(Rx, Ry) - xycmp = cmp(x, y) + Rcmp = (Rx > Ry) - (Rx < Ry) + xycmp = (x > y) - (x < y) eq(Rcmp, xycmp, Frm("%r %r %d %d", x, y, Rcmp, xycmp)) eq(x == y, Rcmp == 0, Frm("%r == %r %d", x, y, Rcmp)) eq(x != y, Rcmp != 0, Frm("%r != %r %d", x, y, Rcmp)) Index: Lib/test/test_sort.py =================================================================== --- Lib/test/test_sort.py (Revision 67635) +++ Lib/test/test_sort.py (Arbeitskopie) @@ -102,7 +102,7 @@ y = x[:] y.reverse() s = x[:] - check("reversed via function", y, s, lambda a, b: cmp(b, a)) + check("reversed via function", y, s, lambda a, b: (b>a)-(b y) - (x < y) L = [1,2] self.assertRaises(ValueError, L.sort, key=CmpToKey(mutating_cmp)) def mutating_cmp(x, y): L.append(3) del L[:] - return cmp(x, y) + return (x > y) - (x < y) self.assertRaises(ValueError, L.sort, key=CmpToKey(mutating_cmp)) memorywaster = [memorywaster] Index: Lib/test/test_deque.py =================================================================== --- Lib/test/test_deque.py (Revision 67635) +++ Lib/test/test_deque.py (Arbeitskopie) @@ -102,7 +102,6 @@ self.assertEqual(x <= y, list(x) <= list(y), (x,y)) self.assertEqual(x > y, list(x) > list(y), (x,y)) self.assertEqual(x >= y, list(x) >= list(y), (x,y)) - self.assertEqual(cmp(x,y), cmp(list(x),list(y)), (x,y)) def test_extend(self): d = deque('a') Index: Lib/test/test_datetime.py =================================================================== --- Lib/test/test_datetime.py (Revision 67635) +++ Lib/test/test_datetime.py (Arbeitskopie) @@ -8,6 +8,7 @@ import unittest from test import support +from test.support import fcmp from datetime import MINYEAR, MAXYEAR from datetime import timedelta @@ -156,9 +157,6 @@ self.assertRaises(TypeError, lambda: () > me) self.assertRaises(TypeError, lambda: () >= me) - self.assertRaises(TypeError, cmp, (), me) - self.assertRaises(TypeError, cmp, me, ()) - ############################################################################# # timedelta tests @@ -309,8 +307,6 @@ self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) - self.assertEqual(cmp(t1, t2), 0) - self.assertEqual(cmp(t2, t1), 0) for args in (3, 3, 3), (2, 4, 4), (2, 3, 5): t2 = timedelta(*args) # this is larger than t1 @@ -326,8 +322,6 @@ self.failUnless(not t2 < t1) self.failUnless(not t1 >= t2) self.failUnless(not t2 <= t1) - self.assertEqual(cmp(t1, t2), -1) - self.assertEqual(cmp(t2, t1), 1) for badarg in OTHERSTUFF: self.assertEqual(t1 == badarg, False) @@ -936,8 +930,6 @@ self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) - self.assertEqual(cmp(t1, t2), 0) - self.assertEqual(cmp(t2, t1), 0) for args in (3, 3, 3), (2, 4, 4), (2, 3, 5): t2 = self.theclass(*args) # this is larger than t1 @@ -953,8 +945,6 @@ self.failUnless(not t2 < t1) self.failUnless(not t1 >= t2) self.failUnless(not t2 <= t1) - self.assertEqual(cmp(t1, t2), -1) - self.assertEqual(cmp(t2, t1), 1) for badarg in OTHERSTUFF: self.assertEqual(t1 == badarg, False) @@ -982,8 +972,6 @@ # But the ordering is undefined self.assertRaises(TypeError, lambda: our < 1) self.assertRaises(TypeError, lambda: 1 < our) - self.assertRaises(TypeError, cmp, our, 1) - self.assertRaises(TypeError, cmp, 1, our) # Repeat those tests with a different class @@ -997,8 +985,6 @@ self.assertEqual(their != our, True) self.assertRaises(TypeError, lambda: our < their) self.assertRaises(TypeError, lambda: their < our) - self.assertRaises(TypeError, cmp, our, their) - self.assertRaises(TypeError, cmp, their, our) # However, if the other class explicitly defines ordering # relative to our class, it is allowed to do so @@ -1024,8 +1010,6 @@ self.assertEqual(their != our, True) self.assertEqual(our < their, True) self.assertEqual(their < our, False) - self.assertEqual(cmp(our, their), -1) - self.assertEqual(cmp(their, our), 1) def test_bool(self): # All dates are considered true. @@ -1423,8 +1407,6 @@ self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) - self.assertEqual(cmp(t1, t2), 0) - self.assertEqual(cmp(t2, t1), 0) for i in range(len(args)): newargs = args[:] @@ -1442,8 +1424,6 @@ self.failUnless(not t2 < t1) self.failUnless(not t1 >= t2) self.failUnless(not t2 <= t1) - self.assertEqual(cmp(t1, t2), -1) - self.assertEqual(cmp(t2, t1), 1) # A helper for timestamp constructor tests. @@ -1711,8 +1691,6 @@ self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) - self.assertEqual(cmp(t1, t2), 0) - self.assertEqual(cmp(t2, t1), 0) for i in range(len(args)): newargs = args[:] @@ -1730,8 +1708,6 @@ self.failUnless(not t2 < t1) self.failUnless(not t1 >= t2) self.failUnless(not t2 <= t1) - self.assertEqual(cmp(t1, t2), -1) - self.assertEqual(cmp(t2, t1), 1) for badarg in OTHERSTUFF: self.assertEqual(t1 == badarg, False) @@ -2105,8 +2081,8 @@ d2 = base.replace(minute=11) for x in d0, d1, d2: for y in d0, d1, d2: - got = cmp(x, y) - expected = cmp(x.minute, y.minute) + got = fcmp(x, y) + expected = fcmp(x.minute, y.minute) self.assertEqual(got, expected) # However, if they're different members, uctoffset is not ignored. @@ -2119,7 +2095,7 @@ d2 = base.replace(minute=11, tzinfo=OperandDependentOffset()) for x in d0, d1, d2: for y in d0, d1, d2: - got = cmp(x, y) + got = fcmp(x, y) if (x is d0 or x is d1) and (y is d0 or y is d1): expected = 0 elif x is y is d2: Index: Lib/test/test_decimal.py =================================================================== --- Lib/test/test_decimal.py (Revision 67635) +++ Lib/test/test_decimal.py (Arbeitskopie) @@ -1013,17 +1013,11 @@ self.failUnless(da != dc) self.failUnless(da <= db) self.failUnless(da >= db) - self.assertEqual(cmp(dc,da), 1) - self.assertEqual(cmp(da,dc), -1) - self.assertEqual(cmp(da,db), 0) #a Decimal and an int self.failUnless(dc > 23) self.failUnless(23 < dc) self.assertEqual(dc, 45) - self.assertEqual(cmp(dc,23), 1) - self.assertEqual(cmp(23,dc), -1) - self.assertEqual(cmp(dc,45), 0) #a Decimal and uncomparable self.assertNotEqual(da, 'ugly') Index: Lib/test/test_uuid.py =================================================================== --- Lib/test/test_uuid.py (Revision 67635) +++ Lib/test/test_uuid.py (Arbeitskopie) @@ -1,5 +1,6 @@ from unittest import TestCase from test import support +from test.support import fcmp import uuid def importable(name): @@ -181,7 +182,7 @@ # Test comparison of UUIDs. for i in range(len(ascending)): for j in range(len(ascending)): - equal(cmp(i, j), cmp(ascending[i], ascending[j])) + equal(fcmp(i, j), fcmp(ascending[i], ascending[j])) # Test sorting of UUIDs (above list is in ascending order). resorted = ascending[:] Index: Lib/test/test_copy.py =================================================================== --- Lib/test/test_copy.py (Revision 67635) +++ Lib/test/test_copy.py (Arbeitskopie) @@ -5,6 +5,7 @@ import unittest from test import support +from test.support import fcmp class TestCopy(unittest.TestCase): @@ -271,7 +272,7 @@ x = [] x.append(x) y = copy.deepcopy(x) - self.assertRaises(RuntimeError, cmp, y, x) + self.assertRaises(RuntimeError, fcmp, y, x) self.assert_(y is not x) self.assert_(y[0] is y) self.assertEqual(len(y), 1) @@ -287,7 +288,7 @@ x = ([],) x[0].append(x) y = copy.deepcopy(x) - self.assertRaises(RuntimeError, cmp, y, x) + self.assertRaises(RuntimeError, fcmp, y, x) self.assert_(y is not x) self.assert_(y[0] is not x[0]) self.assert_(y[0][0] is y) @@ -303,7 +304,7 @@ x = {} x['foo'] = x y = copy.deepcopy(x) - self.assertRaises(TypeError, cmp, y, x) + self.assertRaises(TypeError, fcmp, y, x) self.assert_(y is not x) self.assert_(y['foo'] is y) self.assertEqual(len(y), 1) Index: Lib/test/test_builtin.py =================================================================== --- Lib/test/test_builtin.py (Revision 67635) +++ Lib/test/test_builtin.py (Arbeitskopie) @@ -10,6 +10,7 @@ FutureWarning, __name__) warnings.filterwarnings("ignore", "integer argument expected", DeprecationWarning, "unittest") +import builtins class Squares: @@ -219,21 +220,7 @@ self.assertRaises((OverflowError, ValueError), chr, 2**32) def test_cmp(self): - self.assertEqual(cmp(-1, 1), -1) - self.assertEqual(cmp(1, -1), 1) - self.assertEqual(cmp(1, 1), 0) - # verify that circular objects are not handled - a = []; a.append(a) - b = []; b.append(b) - from collections import UserList - c = UserList(); c.append(c) - self.assertRaises(RuntimeError, cmp, a, b) - self.assertRaises(RuntimeError, cmp, b, c) - self.assertRaises(RuntimeError, cmp, c, a) - self.assertRaises(RuntimeError, cmp, a, c) - # okay, now break the cycles - a.pop(); b.pop(); c.pop() - self.assertRaises(TypeError, cmp) + self.assert_(not hasattr(builtins, "cmp")) def test_compile(self): compile('print(1)\n', '', 'exec') @@ -736,10 +723,6 @@ def __getitem__(self, index): raise ValueError self.assertRaises(ValueError, min, BadSeq()) - class BadNumber: - def __cmp__(self, other): - raise ValueError - self.assertRaises(TypeError, min, (42, BadNumber())) for stmt in ( "min(key=int)", # no args Index: Modules/_ssl.c =================================================================== --- Modules/_ssl.c (Revision 67635) +++ Modules/_ssl.c (Arbeitskopie) @@ -1432,7 +1432,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/bz2module.c =================================================================== --- Modules/bz2module.c (Revision 67635) +++ Modules/bz2module.c (Arbeitskopie) @@ -1307,7 +1307,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -1590,7 +1590,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -1819,7 +1819,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_pickle.c =================================================================== --- Modules/_pickle.c (Revision 67635) +++ Modules/_pickle.c (Arbeitskopie) @@ -715,7 +715,7 @@ i = 0; module_name = NULL; while ((j = PyDict_Next(modules_dict, &i, &module_name, &module))) { - if (PyObject_Compare(module_name, main_str) == 0) + if (PyObject_RichCompareBool(module_name, main_str, Py_EQ) == 1) continue; obj = PyObject_GetAttr(module, global_name); @@ -2645,7 +2645,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -4493,7 +4493,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_gdbmmodule.c =================================================================== --- Modules/_gdbmmodule.c (Revision 67635) +++ Modules/_gdbmmodule.c (Arbeitskopie) @@ -390,7 +390,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ &dbm_as_sequence, /*tp_as_sequence*/ Index: Modules/_tkinter.c =================================================================== --- Modules/_tkinter.c (Revision 67635) +++ Modules/_tkinter.c (Arbeitskopie) @@ -825,7 +825,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - (cmpfunc)PyTclObject_cmp, /*tp_compare*/ + 0, /*tp_reserved*/ (reprfunc)PyTclObject_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -2331,7 +2331,7 @@ 0, /*tp_print */ 0, /*tp_getattr */ 0, /*tp_setattr */ - 0, /*tp_compare */ + 0, /*tp_reserved */ Tktt_Repr, /*tp_repr */ 0, /*tp_as_number */ 0, /*tp_as_sequence */ @@ -2683,7 +2683,7 @@ 0, /*tp_print */ 0, /*tp_getattr */ 0, /*tp_setattr */ - 0, /*tp_compare */ + 0, /*tp_reserved */ 0, /*tp_repr */ 0, /*tp_as_number */ 0, /*tp_as_sequence */ Index: Modules/_curses_panel.c =================================================================== --- Modules/_curses_panel.c (Revision 67635) +++ Modules/_curses_panel.c (Arbeitskopie) @@ -341,7 +341,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_ctypes/callproc.c =================================================================== --- Modules/_ctypes/callproc.c (Revision 67635) +++ Modules/_ctypes/callproc.c (Arbeitskopie) @@ -512,7 +512,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)PyCArg_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_ctypes/stgdict.c =================================================================== --- Modules/_ctypes/stgdict.c (Revision 67635) +++ Modules/_ctypes/stgdict.c (Arbeitskopie) @@ -111,7 +111,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_ctypes/_ctypes.c =================================================================== --- Modules/_ctypes/_ctypes.c (Revision 67635) +++ Modules/_ctypes/_ctypes.c (Arbeitskopie) @@ -179,7 +179,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -713,7 +713,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &CDataType_as_sequence, /* tp_as_sequence */ @@ -755,7 +755,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &CDataType_as_sequence, /* tp_as_sequence */ @@ -988,7 +988,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &CDataType_as_sequence, /* tp_as_sequence */ @@ -1390,7 +1390,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &CDataType_as_sequence, /* tp_as_sequence */ @@ -2059,7 +2059,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &CDataType_as_sequence, /* tp_as_sequence */ @@ -2277,7 +2277,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &CDataType_as_sequence, /* tp_as_sequence */ @@ -2560,7 +2560,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -3889,7 +3889,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)CFuncPtr_repr, /* tp_repr */ &CFuncPtr_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -4032,7 +4032,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -4074,7 +4074,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -4383,7 +4383,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &Array_as_sequence, /* tp_as_sequence */ @@ -4615,7 +4615,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)&Simple_repr, /* tp_repr */ &Simple_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -4992,7 +4992,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ &Pointer_as_number, /* tp_as_number */ &Pointer_as_sequence, /* tp_as_sequence */ @@ -5086,7 +5086,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_ctypes/callbacks.c =================================================================== --- Modules/_ctypes/callbacks.c (Revision 67635) +++ Modules/_ctypes/callbacks.c (Arbeitskopie) @@ -50,7 +50,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_ctypes/cfield.c =================================================================== --- Modules/_ctypes/cfield.c (Revision 67635) +++ Modules/_ctypes/cfield.c (Arbeitskopie) @@ -289,7 +289,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)CField_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_stringio.c =================================================================== --- Modules/_stringio.c (Revision 67635) +++ Modules/_stringio.c (Arbeitskopie) @@ -322,7 +322,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/socketmodule.c =================================================================== --- Modules/socketmodule.c (Revision 67635) +++ Modules/socketmodule.c (Arbeitskopie) @@ -2860,7 +2860,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)sock_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/mmapmodule.c =================================================================== --- Modules/mmapmodule.c (Revision 67635) +++ Modules/mmapmodule.c (Arbeitskopie) @@ -930,7 +930,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ &mmap_as_sequence, /*tp_as_sequence*/ Index: Modules/datetimemodule.c =================================================================== --- Modules/datetimemodule.c (Revision 67635) +++ Modules/datetimemodule.c (Arbeitskopie) @@ -1427,7 +1427,7 @@ * Miscellaneous helpers. */ -/* For various reasons, we need to use tp_richcompare instead of tp_compare. +/* For various reasons, we need to use tp_richcompare instead of tp_reserved. * The comparisons here all most naturally compute a cmp()-like result. * This little helper turns that into a bool result for rich comparisons. */ @@ -2138,7 +2138,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)delta_repr, /* tp_repr */ &delta_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2709,7 +2709,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)date_repr, /* tp_repr */ &date_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2963,7 +2963,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -3478,7 +3478,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)time_repr, /* tp_repr */ &time_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -4606,7 +4606,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)datetime_repr, /* tp_repr */ &datetime_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_lsprof.c =================================================================== --- Modules/_lsprof.c (Revision 67635) +++ Modules/_lsprof.c (Arbeitskopie) @@ -820,7 +820,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/xxmodule.c =================================================================== --- Modules/xxmodule.c (Revision 67635) +++ Modules/xxmodule.c (Arbeitskopie) @@ -106,7 +106,7 @@ 0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)Xxo_setattr, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -224,7 +224,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -279,7 +279,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_multiprocessing/semaphore.c =================================================================== --- Modules/_multiprocessing/semaphore.c (Revision 67635) +++ Modules/_multiprocessing/semaphore.c (Arbeitskopie) @@ -592,7 +592,7 @@ /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, - /* tp_compare */ 0, + /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, Index: Modules/_multiprocessing/connection.h =================================================================== --- Modules/_multiprocessing/connection.h (Revision 67635) +++ Modules/_multiprocessing/connection.h (Arbeitskopie) @@ -487,7 +487,7 @@ /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, - /* tp_compare */ 0, + /* tp_reserved */ 0, /* tp_repr */ (reprfunc)connection_repr, /* tp_as_number */ 0, /* tp_as_sequence */ 0, Index: Modules/_dbmmodule.c =================================================================== --- Modules/_dbmmodule.c (Revision 67635) +++ Modules/_dbmmodule.c (Arbeitskopie) @@ -336,7 +336,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ &dbm_as_sequence, /*tp_as_sequence*/ Index: Modules/cjkcodecs/multibytecodec.c =================================================================== --- Modules/cjkcodecs/multibytecodec.c (Revision 67635) +++ Modules/cjkcodecs/multibytecodec.c (Arbeitskopie) @@ -705,7 +705,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -990,7 +990,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1199,7 +1199,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1529,7 +1529,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1749,7 +1749,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/sha512module.c =================================================================== --- Modules/sha512module.c (Revision 67635) +++ Modules/sha512module.c (Arbeitskopie) @@ -611,7 +611,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -645,7 +645,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_bytesio.c =================================================================== --- Modules/_bytesio.c (Revision 67635) +++ Modules/_bytesio.c (Arbeitskopie) @@ -698,7 +698,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/unicodedata.c =================================================================== --- Modules/unicodedata.c (Revision 67635) +++ Modules/unicodedata.c (Arbeitskopie) @@ -1144,7 +1144,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/arraymodule.c =================================================================== --- Modules/arraymodule.c (Revision 67635) +++ Modules/arraymodule.c (Arbeitskopie) @@ -2063,7 +2063,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)array_repr, /* tp_repr */ 0, /* tp_as_number*/ &array_as_sequence, /* tp_as_sequence*/ @@ -2166,7 +2166,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/selectmodule.c =================================================================== --- Modules/selectmodule.c (Revision 67635) +++ Modules/selectmodule.c (Arbeitskopie) @@ -639,7 +639,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -1097,7 +1097,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1310,7 +1310,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)kqueue_event_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1665,7 +1665,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_randommodule.c =================================================================== --- Modules/_randommodule.c (Revision 67635) +++ Modules/_randommodule.c (Arbeitskopie) @@ -459,7 +459,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/operator.c =================================================================== --- Modules/operator.c (Revision 67635) +++ Modules/operator.c (Arbeitskopie) @@ -349,7 +349,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -523,7 +523,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -654,7 +654,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/zipimport.c =================================================================== --- Modules/zipimport.c (Revision 67635) +++ Modules/zipimport.c (Arbeitskopie) @@ -566,7 +566,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)zipimporter_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/zlibmodule.c =================================================================== --- Modules/zlibmodule.c (Revision 67635) +++ Modules/zlibmodule.c (Arbeitskopie) @@ -977,7 +977,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -1008,7 +1008,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_fileio.c =================================================================== --- Modules/_fileio.c (Revision 67635) +++ Modules/_fileio.c (Arbeitskopie) @@ -871,7 +871,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)fileio_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_sqlite/connection.c =================================================================== --- Modules/_sqlite/connection.c (Revision 67635) +++ Modules/_sqlite/connection.c (Arbeitskopie) @@ -1350,7 +1350,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_sqlite/cache.c =================================================================== --- Modules/_sqlite/cache.c (Revision 67635) +++ Modules/_sqlite/cache.c (Arbeitskopie) @@ -282,7 +282,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -324,7 +324,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_sqlite/statement.c =================================================================== --- Modules/_sqlite/statement.c (Revision 67635) +++ Modules/_sqlite/statement.c (Arbeitskopie) @@ -464,7 +464,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_sqlite/row.c =================================================================== --- Modules/_sqlite/row.c (Revision 67635) +++ Modules/_sqlite/row.c (Arbeitskopie) @@ -210,7 +210,7 @@ (printfunc)pysqlite_row_print, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_sqlite/cursor.c =================================================================== --- Modules/_sqlite/cursor.c (Revision 67635) +++ Modules/_sqlite/cursor.c (Arbeitskopie) @@ -1066,7 +1066,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_sqlite/prepare_protocol.c =================================================================== --- Modules/_sqlite/prepare_protocol.c (Revision 67635) +++ Modules/_sqlite/prepare_protocol.c (Arbeitskopie) @@ -42,7 +42,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_struct.c =================================================================== --- Modules/_struct.c (Revision 67635) +++ Modules/_struct.c (Arbeitskopie) @@ -1853,7 +1853,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_sre.c =================================================================== --- Modules/_sre.c (Revision 67635) +++ Modules/_sre.c (Arbeitskopie) @@ -2625,7 +2625,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -3635,7 +3635,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -3819,7 +3819,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/pyexpat.c =================================================================== --- Modules/pyexpat.c (Revision 67635) +++ Modules/pyexpat.c (Arbeitskopie) @@ -1622,7 +1622,7 @@ (printfunc)0, /*tp_print*/ 0, /*tp_getattr*/ (setattrfunc)xmlparse_setattr, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_reserved*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/parsermodule.c =================================================================== --- Modules/parsermodule.c (Revision 67635) +++ Modules/parsermodule.c (Arbeitskopie) @@ -203,7 +203,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)parser_compare, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/sha1module.c =================================================================== --- Modules/sha1module.c (Revision 67635) +++ Modules/sha1module.c (Arbeitskopie) @@ -452,7 +452,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_elementtree.c =================================================================== --- Modules/_elementtree.c (Revision 67635) +++ Modules/_elementtree.c (Arbeitskopie) @@ -761,7 +761,7 @@ for (i = 0; i < self->extra->length; i++) { PyObject* item = self->extra->children[i]; if (Element_CheckExact(item) && - PyObject_Compare(((ElementObject*)item)->tag, tag) == 0) { + PyObject_RichCompareBool(((ElementObject*)item)->tag, tag, Py_EQ) == 1) { Py_INCREF(item); return item; } @@ -792,7 +792,8 @@ for (i = 0; i < self->extra->length; i++) { ElementObject* item = (ElementObject*) self->extra->children[i]; - if (Element_CheckExact(item) && !PyObject_Compare(item->tag, tag)) { + if (Element_CheckExact(item) && (PyObject_RichCompareBool(item->tag, tag, Py_EQ) == 1)) { + PyObject* text = element_get_text(item); if (text == Py_None) return PyBytes_FromString(""); @@ -830,7 +831,7 @@ for (i = 0; i < self->extra->length; i++) { PyObject* item = self->extra->children[i]; if (Element_CheckExact(item) && - PyObject_Compare(((ElementObject*)item)->tag, tag) == 0) { + PyObject_RichCompareBool(((ElementObject*)item)->tag, tag, Py_EQ) == 1) { if (PyList_Append(out, item) < 0) { Py_DECREF(out); return NULL; @@ -1102,7 +1103,7 @@ for (i = 0; i < self->extra->length; i++) { if (self->extra->children[i] == element) break; - if (PyObject_Compare(self->extra->children[i], element) == 0) + if (PyObject_RichCompareBool(self->extra->children[i], element, Py_EQ) == 1) break; } @@ -1378,7 +1379,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ (setattrfunc)element_setattr, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)element_repr, /* tp_repr */ 0, /* tp_as_number */ &element_as_sequence, /* tp_as_sequence */ @@ -1802,7 +1803,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2558,7 +2559,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_cursesmodule.c =================================================================== --- Modules/_cursesmodule.c (Revision 67635) +++ Modules/_cursesmodule.c (Arbeitskopie) @@ -1662,7 +1662,7 @@ 0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/xxsubtype.c =================================================================== --- Modules/xxsubtype.c (Revision 67635) +++ Modules/xxsubtype.c (Arbeitskopie) @@ -109,7 +109,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -200,7 +200,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_threadmodule.c =================================================================== --- Modules/_threadmodule.c (Revision 67635) +++ Modules/_threadmodule.c (Arbeitskopie) @@ -129,7 +129,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -358,7 +358,7 @@ /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, - /* tp_compare */ 0, + /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, Index: Modules/sha256module.c =================================================================== --- Modules/sha256module.c (Revision 67635) +++ Modules/sha256module.c (Arbeitskopie) @@ -545,7 +545,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -579,7 +579,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_functoolsmodule.c =================================================================== --- Modules/_functoolsmodule.c (Revision 67635) +++ Modules/_functoolsmodule.c (Arbeitskopie) @@ -206,7 +206,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_testcapimodule.c =================================================================== --- Modules/_testcapimodule.c (Revision 67635) +++ Modules/_testcapimodule.c (Arbeitskopie) @@ -1156,7 +1156,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_collectionsmodule.c =================================================================== --- Modules/_collectionsmodule.c (Revision 67635) +++ Modules/_collectionsmodule.c (Arbeitskopie) @@ -848,7 +848,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ deque_repr, /* tp_repr */ 0, /* tp_as_number */ &deque_as_sequence, /* tp_as_sequence */ @@ -970,7 +970,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1052,7 +1052,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1309,7 +1309,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)defdict_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/ossaudiodev.c =================================================================== --- Modules/ossaudiodev.c (Revision 67635) +++ Modules/ossaudiodev.c (Arbeitskopie) @@ -849,7 +849,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -881,7 +881,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/_hashopenssl.c =================================================================== --- Modules/_hashopenssl.c (Revision 67635) +++ Modules/_hashopenssl.c (Arbeitskopie) @@ -339,7 +339,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ EVP_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/itertoolsmodule.c =================================================================== --- Modules/itertoolsmodule.c (Revision 67635) +++ Modules/itertoolsmodule.c (Arbeitskopie) @@ -148,7 +148,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -279,7 +279,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -432,7 +432,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -588,7 +588,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -783,7 +783,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -926,7 +926,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1066,7 +1066,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1261,7 +1261,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1393,7 +1393,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1561,7 +1561,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1808,7 +1808,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2034,7 +2034,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2309,7 +2309,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2453,7 +2453,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2604,7 +2604,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)count_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2739,7 +2739,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)repeat_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -2967,7 +2967,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_compare */ + 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ Index: Modules/_csv.c =================================================================== --- Modules/_csv.c (Revision 67635) +++ Modules/_csv.c (Arbeitskopie) @@ -443,7 +443,7 @@ (printfunc)0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ + 0, /* tp_reserved */ (reprfunc)0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -864,7 +864,7 @@ (printfunc)0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_reserved*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -1286,7 +1286,7 @@ (printfunc)0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_reserved*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Index: Modules/md5module.c =================================================================== --- Modules/md5module.c (Revision 67635) +++ Modules/md5module.c (Arbeitskopie) @@ -476,7 +476,7 @@ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ + 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/