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 eolson
Recipients eolson, jafo, jcea, johansen, ysj.ray
Date 2014-05-01.03:08:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398913680.56.0.867322242953.issue2159@psf.upfronthosting.co.za>
In-reply-to
Content
I did try the suggestion to return Py_False, but that gives the wrong result since Py_False is not 0 and gets returned as Py_True.

I looked for similar code, and this looks like the convention for handling "if obj".  PyObject_IsTrue() is called on the object.  What it returns can be affected by an nb_bool function that returns 0 or 1 (or -1).

Here are a few similar examples that need to implement nb_bool to handle converting an obj to a bool:
Objects/floatobject.c:float_bool
Modules/_datetimemodule.c:delta_bool
Objects/complexobject.c:complex_bool

For many types, there is no nb_bool, and other things are tried such as getting the length.
History
Date User Action Args
2014-05-01 03:08:00eolsonsetrecipients: + eolson, jafo, jcea, johansen, ysj.ray
2014-05-01 03:08:00eolsonsetmessageid: <1398913680.56.0.867322242953.issue2159@psf.upfronthosting.co.za>
2014-05-01 03:08:00eolsonlinkissue2159 messages
2014-05-01 03:08:00eolsoncreate