On 3月7日, 下午10时38分, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote: > En Sat, 07 Mar 2009 07:38:29 -0200, BigHand <hewei...@gmail.com> escribió: > > > how do I pass True to the Python function in the C++ code? > > (I've already suggested using PyErr_Print/PyTraceback_Print instead) > > See the section "Boolean Objects" in the C API Reference: > > "PyObject* Py_True > The Python True object. This object has no methods. It needs to be treated > just like any other object with respect to reference counts." > > -- > Gabriel Genellina
tbArgs = Py_BuildValue("OOOOO", exc_type, exc_value, exc_tb, Py_None, Py_True); tbResultList = PyObject_CallObject(obFunc_format_exception , tbArgs); should increase the ref count of Py_True first? this can't call the python function format_exception successfully either. B.R. BH -- http://mail.python.org/mailman/listinfo/python-list