This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients
Date 2005-06-13.19:10:29
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
tp_richcompare slot as documented here:

http://www.python.org/doc/current/api/type-structs.html

is incorrect.  It states: "The signature is the same as
for PyObject_RichCompare(). The function should return
1 if the requested comparison returns true, 0 if it
returns false. It should return -1 and set an exception
condition when an error occurred during the comparison"

However PyObject_RichCompare() actually returns a
PyObject* not an int.  The documentation at this
location really should spell out the full specification
for the richcomparefunc.

In addition, it's not exactly clear how to implement
unordered comparisons (ones where == and != work, but
<, >, <=, >= don't).  You cannot return
Py_NotImplemented because richcomp always falls back to
pointer comparison unless PyInstance_Check() is true. 
For extension types, this won't be the case and the
right thing to do is actually raise the exception in
the richcomp function.  This needs to be documented too.
History
Date User Action Args
2008-01-20 09:57:54adminlinkissue1219903 messages
2008-01-20 09:57:54admincreate