[Python-Dev] Extension doc bugs

uche.ogbuji@fourthought.com uche.ogbuji@fourthought.com
Fri, 19 Jan 2001 22:29:23 -0700


> For instance, from the object protocol docs: 
> 
> """
> int PyObject_Cmp (PyObject *o1, PyObject *o2, int *result) 
>       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)".
> """
> 
> After getting weird behavior implementing this, and then squinting at the 
> relevant Python 2.0 code, it appears that in actuality the Cmp function is to 
> return the direct comparison results (-1, 0, 1 based on ordering of the 
> parameters)  furthermore, there is no such "result" argument.

Bother.  I didn't squint hard enough.  I mistook the tp_compare slot for the 
PyObject_Cmp equivalent.  I have indeed run into what I'm sure are nits in the 
Python/C API but given that my greatest alarm was false, I'll be more careful 
before bringing up the others.

I'm still curious as to the best forum for this.

-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python