Update of /cvsroot/ctypes/ctypes/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29481
Modified Files:
stgdict.c
Log Message:
Check for invalid types in Structure _fields_.
Index: stgdict.c
===================================================================
RCS file: /cvsroot/ctypes/ctypes/source/stgdict.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** stgdict.c 10 Feb 2005 09:18:37 -0000 1.31
--- stgdict.c 14 Mar 2005 08:03:47 -0000 1.32
***************
*** 264,267 ****
--- 264,273 ----
}
dict = PyType_stgdict(desc);
+ if (dict == NULL) {
+ PyErr_Format(PyExc_TypeError,
+ "second item in _fields_ tuple (index %d) must be a C type",
+ i);
+ return -1;
+ }
stgdict->ffi_type.elements[ffi_ofs + i] = &dict->ffi_type;
dict->flags |= DICTFLAG_FINAL; /* mark field type final */
|