passing uint64_t between python and c++

Jhy-Chun Wang wangjc101 at yahoo.com
Wed Oct 13 18:45:35 EDT 2004


Hi,

I have a c++ extension that does thing like:

extern "C"
static PyObject *
nasUtil_access_cmd(PyObject *self, PyObject *args)
{
    uint64_t paddr;
    uint64_t data;


    if (!PyArg_ParseTuple(args, (char*)"LL", &paddr, &data)) {
	return NULL;
    }
    ...
}

When I pass in a value larger than 0x7fffffff-ffffffffL from python
side, I always get "OverflowError: long too big to convert". I tried
using "int64_t paddr; int64_t data;", got the same error. How do I get
around this? I am using 32bit python 2.3.3 on Solaris 9.

Any help is very appreciated.

Thanks,

Jhychun




More information about the Python-list mailing list