[Cython] [cython-users] Re: Bringing Cython and PyPy closer together

Stefan Behnel stefan_ml at behnel.de
Sun Mar 29 20:02:31 CEST 2015


Lisandro Dalcin schrieb am 29.03.2015 um 19:40:
> On 29 March 2015 at 20:30, Lisandro Dalcin wrote:
>> On 29 March 2015 at 16:10, Stefan Behnel wrote:
>>> Why not call PyObject_RichCompareBool() to make cpyext itself compare the
>>> value to 0?
>>
>> That should definitely work. Let me try to put a patch together.
> 
> Stefan, how to you feel about abusing of Py_False in the call to
> RichCompareBool ?

Wow - evil idea! :)

But then, it's only for cpyext - as long as it works there and comes with a
comment, it's certainly as simple as it gets. bool is clearly defined as an
int subtype in Python.

Just remember to check the error code. Py_SIZE() can't fail in CPython, but
comparisons can, sadly.

Stefan



More information about the cython-devel mailing list