[Python-Dev] Possible C API problem?

"Martin v. Löwis" martin at v.loewis.de
Tue Jul 5 23:05:04 CEST 2005


Gary Robinson wrote:
> #include <Python.h>
> static  double         gfSumChiSquare = 123.0; 
>             
> static PyObject *    
> getSumChiSquare(PyObject *self, PyObject *args){
>     return Py_BuildValue("d", gfSumChiSquare);
>     }
>     
> static PyMethodDef SimMethods[] = {
>     {"getSumChiSquare", getSumChiSquare, METH_NOARGS, "Return 
> fSumChiSquare"},
>     {NULL, NULL, 0, NULL}        /* Sentinel */
> };
> 
> PyMODINIT_FUNC
> inittestfloat(void)
> {
>     (void) Py_InitModule("testfloat", SimMethods);
> }

> Could it be that this is a python bug? Or am I doing something wrong?

You are doing something wrong. As getSumChiSquare is a METH_NOARGS
method, it shouldn't have a PyObject*args argument.

However, python-dev really isn't the place to get urgent help if
"there is intense time pressure to get the next release of our product
(http://www.goombah.com) ready". Instead, if you need help in this
case, you should hire somebody.

Regards,
Martin


More information about the Python-Dev mailing list