You need to check for errors in teh result of `PyObject_IsTrue`: http://docs.python.org/2/c-api/object.html#PyObject_IsTrue when it returns `-1` that means an exception has occurred.