[capi-sig] Does Py_False or Py_True need de-referencing if used in a PyObject_Compare?

Campbell Barton ideasman42 at gmail.com
Mon Dec 17 14:59:17 CET 2012

Take care using PyObject_IsTrue since it will accept many PyObject's
(floats, lists, dicts etc), if you want to be strict with checking
your input its not always so good.
Instead you can use PyLong_AsLong() this works for True/False and any int type.

	int param = PyLong_AsLong(value);
	if (param == -1 && PyErr_Occurred()) {
	  .... error out ...
	... check the int now ...

On Mon, Dec 17, 2012 at 10:23 PM, Gustavo Carneiro <gjcarneiro at gmail.com> wrote:
> PyObject_IsTrue(

- Campbell

More information about the capi-sig mailing list