Python C extension: Value different if passed as list than if passed as number

Anand anand_soliton at
Wed Sep 10 23:43:04 CEST 2003

I have a C extension to a dll function.

static PyObject *_wrap_SetTxCommandRegister(PyObject *self, PyObject
*args) {
    PyObject *resultobj;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    char *arg4 = (char *)"Python" ;
    err result;
*)"iii|s:SetTxCommandRegister",&arg1,&arg2,&arg3,&arg4)) goto fail;
    result = (err)SetTxCommandRegister(arg1,arg2,arg3,(char const
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    return NULL;

Now here is what i pass from python
test = [0xff,0xaf,0xf0]
newint = test[0]
print test

arg1 = 0xaf if i pass either test[0] or newint
arg1 = 0xff if i pass constant like what i have shown in the code

What am i doing wrong?

Thanks in advance

More information about the Python-list mailing list