[ctypes-commit] ctypes/source _ctypes.c,1.195,1.196
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-01-15 10:20:14
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18945 Modified Files: _ctypes.c Log Message: Better error message for COM method calls, when the 'this' parameter is missing or wrong. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.195 retrieving revision 1.196 diff -C2 -d -r1.195 -r1.196 *** _ctypes.c 30 Dec 2004 13:36:25 -0000 1.195 --- _ctypes.c 15 Jan 2005 10:20:04 -0000 1.196 *************** *** 2431,2439 **** /* It's a COM method */ CDataObject *this; ! this = (CDataObject *)PyTuple_GetItem(args, 0); ! if (!this || !CDataObject_Check(this)) { ! /* XXX Better error msg when this == NULL */ PyErr_SetString(PyExc_TypeError, ! "wrong type for this arg"); return NULL; } --- 2431,2443 ---- /* It's a COM method */ CDataObject *this; ! this = (CDataObject *)PyTuple_GetItem(args, 0); /* borrowed ref! */ ! if (!this) { ! PyErr_SetString(PyExc_ValueError, ! "native com method call without 'this' parameter"); ! return NULL; ! } ! if (!CDataObject_Check(this)) { PyErr_SetString(PyExc_TypeError, ! "Expected a COM this pointer as first argument"); return NULL; } *************** *** 3218,3221 **** --- 3222,3226 ---- proto = stgdict->proto; + /* XXXXXX MAKE SURE PROTO IS NOT NULL! */ itemdict = PyType_stgdict(proto); size = itemdict->size; *************** *** 3257,3260 **** --- 3262,3266 ---- size = stgdict->size / stgdict->length; + /* XXXXX Make sure proto is NOT NULL! */ return CData_set((PyObject *)self, stgdict->proto, stgdict->setfunc, value, index, size, *(void **)self->b_ptr); |