pass bool values to the Python function in embedded python 3.0

BigHand heweiwei at gmail.com
Sat Mar 7 18:21:04 EST 2009


On 3月7日, 下午10时38分, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> En Sat, 07 Mar 2009 07:38:29 -0200, BigHand <hewei... at 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



More information about the Python-list mailing list