You could use a format like "#s#sO", and then use PyFloat_Check,
PyFloat_AsDouble, and the equivalent PyInt macros to get the "C" value out of
the Python object.

You should be able to use the converter "O&" to get what you want.  The
conversion function might look like:
        int double_only(PyObject *o, double *d) {
            if(!PyFloat_Check(o)) return 0;
            *d = PyFloat_AsDouble(o);
        }
and the call would be
        
if(PyArg_ParseTuple(args,"s#s#O&",&cname,&lname,&cprop,&lprop,double_only,&x))
             mdbgetd_(cname,cprop,&x,&z,lname,lprop);
(untested)

I believe that if you write
        if(PyArg_ParseTuple(...))
        else(PyArg_ParseTuple(...))
you're missing a PyErr_Clear() before the second PyArg_ParseTuple().  Returning
non-NULL when an exception has been set in C code will lead to a hard-to-trace
failure down the road.

Jeff

Attachment: pgpq4yB9LZ1AX.pgp
Description: PGP signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to