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

_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to