Extending Python on Win32 - incompatible types warning

Opinderjit bhellao at my-deja.com
Mon Sep 18 22:31:58 CEST 2000

I am trying to compile the following C code on Win32. Although the code
seems to work fine when I call it in Python, for the function call
   "df += PyFloat_AsDouble(f)"
the compiler generates the following warning:

: warning C4133: 'function' : incompatible types - from 'struct
PyFloatObject *' to 'struct _object *'

I would appreciate any help.

---sample code---
PyObject *idatalist = NULL;
PyFloatObject *f = NULL;
double df = 0.0;

if (!PyArg_ParseTuple(args, "O", &idatalist))
    return NULL;

if (!PyList_Check(idatalist)) onError("input argument must be a list")
len = PyList_Size(idatalist);
for (i=0; i<len; i++)
    f = (PyFloatObject *) PyList_GetItem(idatalist, i);
    df += PyFloat_AsDouble(f);

Sent via Deja.com http://www.deja.com/
Before you buy.

More information about the Python-list mailing list