On Thu, Dec 13, 2012 at 4:21 PM, Robert Steckroth <robertsteckroth@gmail.com
wrote:
Does the below statement have a memory leak?
if ( PyObject_Compare(update_var, Py_False)
Do I need to assign the Py_False first and DECREF it, or is the above snippet ok alone.
It's safe, but note that it is more correct to use PyObject_IsTrue: there are more values that can be considered true or false, besides python's True and False objects.
if (!PyObject_IsTrue(update_var)) { ... }