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 Devin Jeanpierre
Recipients Devin Jeanpierre, docs@python
Date 2011-01-15.01:00:55
SpamBayes Score 1.6998464e-10
Marked as misclassified No
Message-id <1295053260.1.0.0634834443195.issue10912@psf.upfronthosting.co.za>
In-reply-to
Content
PyObject_RichCoareBool is, according to the documentation in trunk (Doc\c-api\object.rst), exactly the same as PyObject_RichCompare, except it 1, 0, or -1 for error, false, and true respectively. However, it differs in behavior by both that, and also by assuming that identity implies equality. This noted in a two year-old ML post (sadly, no bug report was posted as best as I can find): http://mail.python.org/pipermail/python-list/2009-March/1195170.html

Ideally PyObject_RichCompareBool should probably be named something else, since it can no longer be used, strictly, as "PyObject_RichCompare, but returning a C bool" (or, rather, a C int). Some suggestions were offered in the mailing list thread above.

I'm filing this as a documentation bug because I find that outcome unlikely. At least the documentation should note the difference in behavior, so that people do not accidentally write C code that does not behave as intended.

This issue is related to, but different from issue 4296, which objected to the new container behavior created by the change to PyObject_RichCompareBool. My only objection here is that the latter change does not appear to be documented.

I would supply a patch for the tests, but PyObject_RichCompareBool is apparently not directly tested anywhere, just tested obliquely through testing the containment operator, and this was changed by the same commit that changed PyObject_RichCompareBool. I don't know how to word the (very small!) change to the docs.
History
Date User Action Args
2011-01-15 01:01:00Devin Jeanpierresetrecipients: + Devin Jeanpierre, docs@python
2011-01-15 01:01:00Devin Jeanpierresetmessageid: <1295053260.1.0.0634834443195.issue10912@psf.upfronthosting.co.za>
2011-01-15 01:00:55Devin Jeanpierrelinkissue10912 messages
2011-01-15 01:00:55Devin Jeanpierrecreate