ctypes-commit Mailing List for ctypes (Page 84)
Brought to you by:
theller
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(90) |
Jun
(143) |
Jul
(106) |
Aug
(94) |
Sep
(84) |
Oct
(163) |
Nov
(60) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(128) |
Feb
(79) |
Mar
(227) |
Apr
(192) |
May
(179) |
Jun
(41) |
Jul
(53) |
Aug
(103) |
Sep
(28) |
Oct
(38) |
Nov
(81) |
Dec
(17) |
2006 |
Jan
(184) |
Feb
(111) |
Mar
(188) |
Apr
(67) |
May
(58) |
Jun
(123) |
Jul
(73) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Thomas H. <th...@us...> - 2004-11-05 11:19:17
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24890 Modified Files: stgdict.c Log Message: More code refactoring. Index: stgdict.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/stgdict.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** stgdict.c 5 Nov 2004 11:05:52 -0000 1.24 --- stgdict.c 5 Nov 2004 11:19:07 -0000 1.25 *************** *** 149,152 **** --- 149,173 ---- } + static PyObject * + _get_fields(PyObject *type, int *plen) + { + PyObject *fields; + fields = PyObject_GetAttrString(type, "_fields_"); + if (!fields) { + PyErr_SetString(PyExc_AttributeError, + "class must define a '_fields_' attribute"); + return NULL; + } + + *plen = PySequence_Length(fields); + if (*plen == -1) { + PyErr_SetString(PyExc_AttributeError, + "'_fields_' must be a sequence of pairs"); + Py_DECREF(fields); + return NULL; + } + return fields; + } + /* Retrieve the (optional) _pack_ attribute from a type, the _fields_ attribute, *************** *** 168,185 **** return NULL; ! fields = PyObject_GetAttrString(type, "_fields_"); ! if (!fields) { ! PyErr_SetString(PyExc_AttributeError, ! "class must define a '_fields_' attribute"); ! return NULL; ! } ! ! len = PySequence_Length(fields); ! if (len == -1) { ! PyErr_SetString(PyExc_AttributeError, ! "'_fields_' must be a sequence of pairs"); ! Py_DECREF(fields); return NULL; - } stgdict = (StgDictObject *)PyObject_CallObject( --- 189,195 ---- return NULL; ! fields = _get_fields(type, &len); ! if (fields == NULL) return NULL; stgdict = (StgDictObject *)PyObject_CallObject( |
From: Thomas H. <th...@us...> - 2004-11-05 11:06:05
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22642 Modified Files: stgdict.c Log Message: Code refactoring. Index: stgdict.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/stgdict.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** stgdict.c 4 Nov 2004 20:42:56 -0000 1.23 --- stgdict.c 5 Nov 2004 11:05:52 -0000 1.24 *************** *** 128,145 **** #endif ! /* ! Retrive the (optional) _pack_ attribute from a type, the _fields_ attribute, ! and create an StgDictObject. Used for Structure and Union subclasses. ! */ ! PyObject * ! StgDict_ForType(PyObject *type, int isStruct) { - StgDictObject *stgdict; - int len, offset, size, align, i; - int union_size, total_align; - int field_size = 0; - int bitofs; PyObject *isPacked; - PyObject *fields; int pack = 0; --- 128,135 ---- #endif ! static int ! _get_packing(PyObject *type) { PyObject *isPacked; int pack = 0; *************** *** 151,159 **** PyErr_SetString(PyExc_ValueError, "_pack_ must be a non-negative integer"); ! return NULL; } Py_DECREF(isPacked); } else PyErr_Clear(); fields = PyObject_GetAttrString(type, "_fields_"); --- 141,170 ---- PyErr_SetString(PyExc_ValueError, "_pack_ must be a non-negative integer"); ! return -1; } Py_DECREF(isPacked); } else PyErr_Clear(); + return pack; + } + + /* + Retrieve the (optional) _pack_ attribute from a type, the _fields_ attribute, + and create an StgDictObject. Used for Structure and Union subclasses. + */ + PyObject * + StgDict_ForType(PyObject *type, int isStruct) + { + StgDictObject *stgdict; + int len, offset, size, align, i; + int union_size, total_align; + int field_size = 0; + int bitofs; + PyObject *fields; + int pack; + + pack = _get_packing(type); + if (pack == -1) + return NULL; fields = PyObject_GetAttrString(type, "_fields_"); |
From: Thomas H. <th...@us...> - 2004-11-05 10:50:32
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19663 Modified Files: Tag: DELAYED_STRUCTS_BRANCH ctypes.h Log Message: Merged with HEAD. Index: ctypes.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/ctypes.h,v retrieving revision 1.59 retrieving revision 1.59.2.1 diff -C2 -d -r1.59 -r1.59.2.1 *** ctypes.h 4 Nov 2004 20:03:15 -0000 1.59 --- ctypes.h 5 Nov 2004 10:50:13 -0000 1.59.2.1 *************** *** 152,156 **** metatypes */ typedef struct { ! PyDictObject dict; /* a subclass of dict */ int size; /* number of bytes */ int align; /* alignment requirements */ --- 152,156 ---- metatypes */ typedef struct { ! PyDictObject dict; /* first part identical to PyDictObject */ int size; /* number of bytes */ int align; /* alignment requirements */ |
From: Thomas H. <th...@us...> - 2004-11-05 10:47:46
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18969 Modified Files: ctypes.h Log Message: Fix a comment. Index: ctypes.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/ctypes.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** ctypes.h 4 Nov 2004 20:03:15 -0000 1.59 --- ctypes.h 5 Nov 2004 10:47:34 -0000 1.60 *************** *** 152,156 **** metatypes */ typedef struct { ! PyDictObject dict; /* a subclass of dict */ int size; /* number of bytes */ int align; /* alignment requirements */ --- 152,156 ---- metatypes */ typedef struct { ! PyDictObject dict; /* first part identical to PyDictObject */ int size; /* number of bytes */ int align; /* alignment requirements */ |
From: Thomas H. <th...@us...> - 2004-11-05 10:36:47
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16719 Modified Files: _ctypes.c Log Message: Rename a function. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.181 retrieving revision 1.182 diff -C2 -d -r1.181 -r1.182 *** _ctypes.c 4 Nov 2004 20:03:15 -0000 1.181 --- _ctypes.c 5 Nov 2004 10:36:36 -0000 1.182 *************** *** 106,116 **** /* StructType_Type - a meta type/class. Creating a new class using this one as ! __metaclass__ will call the contructor CDataType_new. CDataType_new ! replaces the tp_dict member with a new instance of StgDict, and initializes ! the C accessible fields somehow. */ static PyObject * ! CDataType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isStruct) { PyTypeObject *result; --- 106,116 ---- /* StructType_Type - a meta type/class. Creating a new class using this one as ! __metaclass__ will call the contructor StructUnionType_new. It replaces the ! tp_dict member with a new instance of StgDict, and initializes the C ! accessible fields somehow. */ static PyObject * ! StructUnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isStruct) { PyTypeObject *result; *************** *** 149,153 **** StructType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! return CDataType_new(type, args, kwds, 1); } --- 149,153 ---- StructType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! return StructUnionType_new(type, args, kwds, 1); } *************** *** 155,159 **** UnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! return CDataType_new(type, args, kwds, 0); } --- 155,159 ---- UnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! return StructUnionType_new(type, args, kwds, 0); } |
From: Thomas H. <th...@us...> - 2004-11-05 10:33:43
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16273 Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/ctypes/ctypes/.cvsignore,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** .cvsignore 27 Aug 2004 19:33:35 -0000 1.6 --- .cvsignore 5 Nov 2004 10:33:32 -0000 1.7 *************** *** 16,17 **** --- 16,18 ---- extensions test.output + comtypes \ No newline at end of file |
From: Thomas H. <th...@us...> - 2004-11-04 20:43:21
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4144 Modified Files: stgdict.c Log Message: Fix a refcount leak (according to the unittests, although I'm not quite sure which path through this code it takes). Index: stgdict.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/stgdict.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** stgdict.c 4 Nov 2004 20:03:15 -0000 1.22 --- stgdict.c 4 Nov 2004 20:42:56 -0000 1.23 *************** *** 200,203 **** --- 200,204 ---- PyErr_SetString(PyExc_AttributeError, "'_fields_' must be a sequence of pairs"); + Py_DECREF(fields); Py_XDECREF(pair); return NULL; *************** *** 229,232 **** --- 230,234 ---- "bit fields not allowed for type %s", ((PyTypeObject *)desc)->tp_name); + Py_DECREF(fields); Py_DECREF(pair); return NULL; *************** *** 235,238 **** --- 237,241 ---- PyErr_SetString(PyExc_ValueError, "number of bits invalid for bit field"); + Py_DECREF(fields); Py_DECREF(pair); return NULL; *************** *** 256,259 **** --- 259,263 ---- if (!prop) { + Py_DECREF(fields); Py_DECREF(pair); Py_DECREF((PyObject *)stgdict); *************** *** 261,264 **** --- 265,269 ---- } if (-1 == PyDict_SetItem(realdict, name, prop)) { + Py_DECREF(fields); Py_DECREF(prop); Py_DECREF(pair); |
From: Thomas H. <th...@us...> - 2004-11-04 20:03:27
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26713 Modified Files: stgdict.c ctypes.h _ctypes.c Log Message: Replace the StgDict_FromDict function with a more useful StgDict_ForType, this retrieves the _fields_ and _pack_ attributes from the type itself. Later, the function can probably be even update the type's dict itself. Index: ctypes.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/ctypes.h,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** ctypes.h 21 Oct 2004 08:06:00 -0000 1.58 --- ctypes.h 4 Nov 2004 20:03:15 -0000 1.59 *************** *** 68,72 **** #define StgDict_CheckExact(v) ((v)->ob_type == &StgDict_Type) #define StgDict_Check(v) PyObject_TypeCheck(v, &StgDict_Type) ! extern PyObject *StgDict_FromDict(PyObject *fields, PyObject *typedict, int isStruct); extern int PyType_stginfo(PyTypeObject *self, int *psize, int *palign, int *plength); extern int PyObject_stginfo(PyObject *self, int *psize, int *palign, int *plength); --- 68,72 ---- #define StgDict_CheckExact(v) ((v)->ob_type == &StgDict_Type) #define StgDict_Check(v) PyObject_TypeCheck(v, &StgDict_Type) ! extern PyObject *StgDict_ForType(PyObject *type, int isStruct); extern int PyType_stginfo(PyTypeObject *self, int *psize, int *palign, int *plength); extern int PyObject_stginfo(PyObject *self, int *psize, int *palign, int *plength); Index: stgdict.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/stgdict.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** stgdict.c 18 Oct 2004 08:07:05 -0000 1.21 --- stgdict.c 4 Nov 2004 20:03:15 -0000 1.22 *************** *** 129,139 **** /* ! This is a helper function for the StructType_Type object. ! Hm, actually only for Structure types, since it requires the ! _fields_ attribute. */ - PyObject * ! StgDict_FromDict(PyObject *fields, PyObject *typedict, int isStruct) { StgDictObject *stgdict; --- 129,137 ---- /* ! Retrive the (optional) _pack_ attribute from a type, the _fields_ attribute, ! and create an StgDictObject. Used for Structure and Union subclasses. */ PyObject * ! StgDict_ForType(PyObject *type, int isStruct) { StgDictObject *stgdict; *************** *** 143,161 **** int bitofs; PyObject *isPacked; int pack = 0; ! if (!typedict) ! return NULL; ! ! isPacked = PyDict_GetItemString(typedict, "_pack_"); if (isPacked) { pack = PyInt_AsLong(isPacked); if (pack < 0 || PyErr_Occurred()) { PyErr_SetString(PyExc_ValueError, "_pack_ must be a non-negative integer"); return NULL; } ! } if (!fields) { PyErr_SetString(PyExc_AttributeError, --- 141,161 ---- int bitofs; PyObject *isPacked; + PyObject *fields; int pack = 0; ! isPacked = PyObject_GetAttrString(type, "_pack_"); if (isPacked) { pack = PyInt_AsLong(isPacked); if (pack < 0 || PyErr_Occurred()) { + Py_XDECREF(isPacked); PyErr_SetString(PyExc_ValueError, "_pack_ must be a non-negative integer"); return NULL; } ! Py_DECREF(isPacked); ! } else ! PyErr_Clear(); + fields = PyObject_GetAttrString(type, "_fields_"); if (!fields) { PyErr_SetString(PyExc_AttributeError, *************** *** 168,171 **** --- 168,172 ---- PyErr_SetString(PyExc_AttributeError, "'_fields_' must be a sequence of pairs"); + Py_DECREF(fields); return NULL; } *************** *** 173,178 **** stgdict = (StgDictObject *)PyObject_CallObject( (PyObject *)&StgDict_Type, NULL); ! if (!stgdict) return NULL; offset = 0; --- 174,181 ---- stgdict = (StgDictObject *)PyObject_CallObject( (PyObject *)&StgDict_Type, NULL); ! if (!stgdict) { ! Py_DECREF(fields); return NULL; + } offset = 0; *************** *** 267,270 **** --- 270,274 ---- } #undef realdict + Py_DECREF(fields); if (!isStruct) Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.180 retrieving revision 1.181 diff -C2 -d -r1.180 -r1.181 *** _ctypes.c 4 Nov 2004 09:58:17 -0000 1.180 --- _ctypes.c 4 Nov 2004 20:03:15 -0000 1.181 *************** *** 115,128 **** { PyTypeObject *result; ! PyObject *fields, *dict; ! PyObject *cls_dict; - cls_dict = PyTuple_GetItem(args, 2); /* borrowed ref */ - if (!cls_dict) { - /* Hm. Should not be possible, but who knows. */ - PyErr_SetString(PyExc_ValueError, - "class creation without class dict?"); - return NULL; - } /* create the new instance (which is a class, since we are a metatype!) */ --- 115,120 ---- { PyTypeObject *result; ! PyObject *dict; /* create the new instance (which is a class, since we are a metatype!) */ *************** *** 135,145 **** return (PyObject *)result; ! fields = PyObject_GetAttrString((PyObject *)result, "_fields_"); ! if (fields == NULL) { ! PyErr_Clear(); ! return (PyObject *)result; ! } ! dict = StgDict_FromDict(fields, cls_dict, isStruct); ! Py_DECREF(fields); if (!dict) { Py_DECREF(result); --- 127,131 ---- return (PyObject *)result; ! dict = StgDict_ForType((PyObject *)result, isStruct); if (!dict) { Py_DECREF(result); |
From: Thomas H. <th...@us...> - 2004-11-04 18:04:58
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29143 Modified Files: test_structures.py Log Message: Reenable some tests. Index: test_structures.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_structures.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_structures.py 22 Oct 2004 07:27:18 -0000 1.25 --- test_structures.py 4 Nov 2004 18:04:41 -0000 1.26 *************** *** 290,298 **** self.failUnlessEqual(items, [1, 2, 3]) ! # The following are bugs: # This fails with SystemError: bad arg to internal function ! # s.array[0] = 42 # and this one with IndexError: invalid index ! # s.array[1] = 42 if __name__ == '__main__': --- 290,313 ---- self.failUnlessEqual(items, [1, 2, 3]) ! # The following are bugs, but are included here because the unittests ! # also describe the current behaviour. ! # # This fails with SystemError: bad arg to internal function ! # or with IndexError (with a patch I have) ! try: ! s.array[0] = 42 ! except (SystemError, IndexError): ! pass ! items = [s.array[i] for i in range(3)] ! self.failUnlessEqual(items, [1, 2, 3]) ! # and this one with IndexError: invalid index ! try: ! s.array[1] = 42 ! except IndexError: ! pass ! ! items = [s.array[i] for i in range(3)] ! self.failUnlessEqual(items, [1, 2, 3]) if __name__ == '__main__': |
From: Thomas H. <th...@us...> - 2004-11-04 10:35:19
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25422 Modified Files: callproc.c Log Message: Fix a refcount leak in the cast function. Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** callproc.c 29 Oct 2004 18:46:38 -0000 1.115 --- callproc.c 4 Nov 2004 10:35:10 -0000 1.116 *************** *** 1312,1321 **** return NULL; result = (CDataObject *)PyObject_CallFunctionObjArgs(ctype, NULL); ! if (result == NULL) return NULL; // result->b_size // a.ffi_type->size memcpy(result->b_ptr, &a.value, min(result->b_size, a.ffi_type->size)); return (PyObject *)result; } --- 1312,1324 ---- return NULL; result = (CDataObject *)PyObject_CallFunctionObjArgs(ctype, NULL); ! if (result == NULL) { ! Py_XDECREF(a.keep); return NULL; + } // result->b_size // a.ffi_type->size memcpy(result->b_ptr, &a.value, min(result->b_size, a.ffi_type->size)); + Py_XDECREF(a.keep); return (PyObject *)result; } |
From: Thomas H. <th...@us...> - 2004-11-04 09:58:27
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18669 Modified Files: _ctypes.c Log Message: Better to detect an error early. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.179 retrieving revision 1.180 diff -C2 -d -r1.179 -r1.180 *** _ctypes.c 3 Nov 2004 19:06:08 -0000 1.179 --- _ctypes.c 4 Nov 2004 09:58:17 -0000 1.180 *************** *** 1966,1970 **** if (!objects) return -1; ! result = _CData_set(mem, type, setfunc, value, size, ptr); --- 1966,1974 ---- if (!objects) return -1; ! if (index < 0 || PyList_Size(objects) <= index) { ! PyErr_SetString(PyExc_IndexError, ! "invalid index"); ! return -1; ! } result = _CData_set(mem, type, setfunc, value, size, ptr); |
From: Thomas H. <th...@us...> - 2004-11-03 19:06:19
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14672 Modified Files: _ctypes.c Log Message: Remove an unused parameter in the _CData_set function. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.178 retrieving revision 1.179 diff -C2 -d -r1.178 -r1.179 *** _ctypes.c 29 Oct 2004 19:08:27 -0000 1.178 --- _ctypes.c 3 Nov 2004 19:06:08 -0000 1.179 *************** *** 1864,1868 **** static PyObject * _CData_set(CDataObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value, ! int index, int size, char *ptr) { CDataObject *src; --- 1864,1868 ---- static PyObject * _CData_set(CDataObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value, ! int size, char *ptr) { CDataObject *src; *************** *** 1889,1893 **** } return _CData_set(dst, type, setfunc, ob, ! index, size, ptr); } else { PyErr_Format(PyExc_TypeError, --- 1889,1893 ---- } return _CData_set(dst, type, setfunc, ob, ! size, ptr); } else { PyErr_Format(PyExc_TypeError, *************** *** 1968,1972 **** result = _CData_set(mem, type, setfunc, value, ! index, size, ptr); if (result == NULL) return -1; --- 1968,1972 ---- result = _CData_set(mem, type, setfunc, value, ! size, ptr); if (result == NULL) return -1; |
From: Thomas H. <th...@us...> - 2004-11-02 16:34:06
|
Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6135 Modified Files: nodes.py Log Message: PointerType, FundamentalType and Struct now have align and size attributes, measured in bits. Index: nodes.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/nodes.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** nodes.py 5 Oct 2004 06:52:44 -0000 1.8 --- nodes.py 2 Nov 2004 16:33:56 -0000 1.9 *************** *** 41,46 **** class FundamentalType(object): ! def __init__(self, name): self.name = name def __repr__(self): --- 41,48 ---- class FundamentalType(object): ! def __init__(self, name, size, align): self.name = name + self.size = size + self.align = align def __repr__(self): *************** *** 48,53 **** class PointerType(object): ! def __init__(self, typ): self.typ = typ def __repr__(self): --- 50,57 ---- class PointerType(object): ! def __init__(self, typ, size, align): self.typ = typ + self.size = size + self.align = align def __repr__(self): *************** *** 98,103 **** def __init__(self, name, align, members, bases, size, artificial=None): self.name = name ! assert int(align) % 8 == 0 ! self.align = int(align) / 8 self.members = members self.bases = bases --- 102,106 ---- def __init__(self, name, align, members, bases, size, artificial=None): self.name = name ! self.align = align self.members = members self.bases = bases *************** *** 113,118 **** def __init__(self, name, align, members, bases, size, artificial=None): self.name = name ! assert int(align) % 8 == 0 ! self.align = int(align) / 8 self.members = members self.bases = bases --- 116,120 ---- def __init__(self, name, align, members, bases, size, artificial=None): self.name = name ! self.align = align self.members = members self.bases = bases *************** *** 138,143 **** class Enumeration(object): ! def __init__(self, name): self.name = name self.values = [] --- 140,147 ---- class Enumeration(object): ! def __init__(self, name, size, align): self.name = name + self.size = size + self.align = align self.values = [] |
From: Thomas H. <th...@us...> - 2004-11-02 16:33:10
|
Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5974 Modified Files: gccxmlparser.py Log Message: Several fixes. Index: gccxmlparser.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/gccxmlparser.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gccxmlparser.py 1 Oct 2004 19:56:50 -0000 1.2 --- gccxmlparser.py 2 Nov 2004 16:33:00 -0000 1.3 *************** *** 25,32 **** if verbose: print >> sys.stderr, "writing temporary C source file %s" % c_file ! os.write(handle, 'extern "C" {\n'); for fname in fnames: os.write(handle, '#include <%s>\n' % fname) ! os.write(handle, '}'); os.close(handle) --- 25,32 ---- if verbose: print >> sys.stderr, "writing temporary C source file %s" % c_file ! ## os.write(handle, 'extern "C" {\n'); for fname in fnames: os.write(handle, '#include <%s>\n' % fname) ! ## os.write(handle, '}'); os.close(handle) *************** *** 59,63 **** class GCCXML_Handler(xml.sax.handler.ContentHandler): has_values = Set(["Enumeration", "Function", "FunctionType", ! "OperatorFunction", "Method", "Constructor"]) def __init__(self, *args): --- 59,64 ---- class GCCXML_Handler(xml.sax.handler.ContentHandler): has_values = Set(["Enumeration", "Function", "FunctionType", ! "OperatorFunction", "Method", "Constructor", ! "Destructor", "OperatorMethod"]) def __init__(self, *args): *************** *** 74,83 **** mth = getattr(self, name) result = mth(attrs) ! if result is None: ! return ! # record the result ! _id = attrs.get("id", None) ! if _id is not None: ! self.all[_id] = result # if this element has children, push onto the context if name in self.has_values: --- 75,83 ---- mth = getattr(self, name) result = mth(attrs) ! if result is not None: ! # record the result ! _id = attrs.get("id", None) ! if _id is not None: ! self.all[_id] = result # if this element has children, push onto the context if name in self.has_values: *************** *** 87,94 **** # if this element has children, pop the context if name in self.has_values: ! self.context = self.context[:-1] ################################ # do-nothing element handlers def GCC_XML(self, attrs): pass --- 87,97 ---- # if this element has children, pop the context if name in self.has_values: ! self.context.pop() ################################ # do-nothing element handlers + + def Class(self, attrs): pass + def Destructor(self, attrs): pass def GCC_XML(self, attrs): pass *************** *** 99,102 **** --- 102,106 ---- def Ellipsis(self, attrs): pass def File(self, attrs): pass + def OperatorMethod(self, attrs): pass ################################ *************** *** 115,119 **** def FundamentalType(self, attrs): name = attrs["name"] ! return nodes.FundamentalType(name) def _fixup_FundamentalType(self, t): pass --- 119,128 ---- def FundamentalType(self, attrs): name = attrs["name"] ! if name == "void": ! size = "" ! else: ! size = attrs["size"] ! align = attrs["align"] ! return nodes.FundamentalType(name, size, align) def _fixup_FundamentalType(self, t): pass *************** *** 121,125 **** def PointerType(self, attrs): typ = attrs["type"] ! return nodes.PointerType(typ) def _fixup_PointerType(self, p): --- 130,136 ---- def PointerType(self, attrs): typ = attrs["type"] ! size = attrs["size"] ! align = attrs["align"] ! return nodes.PointerType(typ, size, align) def _fixup_PointerType(self, p): *************** *** 201,205 **** def Argument(self, attrs): typ = attrs["type"] ! self.context[-1].add_argument(typ) # name? # enumerations --- 212,218 ---- def Argument(self, attrs): typ = attrs["type"] ! parent = self.context[-1] ! if parent is not None: ! parent.add_argument(typ) # name? # enumerations *************** *** 208,217 **** # id, name name = attrs["name"] if attrs.get("artificial"): # enum {} ENUM_NAME; ! return nodes.Enumeration(name) else: # enum tagENUM {}; ! enum = nodes.Enumeration(None) self.artificial.append(nodes.Typedef(name, enum)) return enum --- 221,232 ---- # id, name name = attrs["name"] + size = attrs["size"] + align = attrs["align"] if attrs.get("artificial"): # enum {} ENUM_NAME; ! return nodes.Enumeration(name, size, align) else: # enum tagENUM {}; ! enum = nodes.Enumeration(None, size, align) self.artificial.append(nodes.Typedef(name, enum)) return enum *************** *** 284,290 **** nodes.Typedef, nodes.Enumeration, nodes.Function, nodes.Structure, nodes.Union) result = [] ! for i in self.all.values(): mth = getattr(self, "_fixup_" + type(i).__name__) ! mth(i) for i in self.artificial + self.all.values(): if isinstance(i, interesting): --- 299,311 ---- nodes.Typedef, nodes.Enumeration, nodes.Function, nodes.Structure, nodes.Union) result = [] ! remove = [] ! for n, i in self.all.items(): mth = getattr(self, "_fixup_" + type(i).__name__) ! try: ! mth(i) ! except KeyError: # XXX better exception catching ! remove.append(n) ! for n in remove: ! del self.all[n] for i in self.artificial + self.all.values(): if isinstance(i, interesting): |
From: Thomas H. <th...@us...> - 2004-10-29 19:31:20
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29081 Modified Files: ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** ChangeLog 29 Oct 2004 19:09:01 -0000 1.69 --- ChangeLog 29 Oct 2004 19:31:09 -0000 1.70 *************** *** 11,14 **** --- 11,17 ---- a WindowsError. + The big advantage is that now HRESULT is also usable in the + argtypes list. + Although HRESULT is defined in python code (since it is derived from c_long), the _check_retval_ method is implemented in C - in |
From: Thomas H. <th...@us...> - 2004-10-29 19:09:10
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23372 Modified Files: ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** ChangeLog 28 Oct 2004 17:45:14 -0000 1.68 --- ChangeLog 29 Oct 2004 19:09:01 -0000 1.69 *************** *** 1,4 **** --- 1,25 ---- + 2004-10-29 Thomas Heller <th...@py...> + + * (Message): Define a new protocol for function's restype. If it + is a ctypes' type, it is handled in the usual way. But if it + additionally has an _check_retval_ attribute, this is called with + the result, and the return value of this call is the functions + return value. + + This allows to define HRESULT as a ctypes' type, because it can + check for failure in it's _check_retval_ static method, and raise + a WindowsError. + + Although HRESULT is defined in python code (since it is derived + from c_long), the _check_retval_ method is implemented in C - in + this way the traceback won't include the _check_retval_ method + definition itself. + + * (Message): Increased version number to 0.9.3. + 2004-10-28 Thomas Heller <th...@py...> + * (Message): ctypes 0.9.2 released. + * Renamed the functions: get_string -> string_at, get_wstring -> wstring_at *************** *** 92,96 **** 2004-09-21 Thomas Heller <th...@py...> ! * (Message): Increased version number to 0.9.2. 2004-09-16 Thomas Heller <th...@py...> --- 113,117 ---- 2004-09-21 Thomas Heller <th...@py...> ! * (Message): Increased version number to 0.9.2. 2004-09-16 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2004-10-29 19:08:39
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23231 Modified Files: _ctypes.c Log Message: Change version number to 0.9.3. Have windows-specific code inside an if block. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** _ctypes.c 22 Oct 2004 07:22:00 -0000 1.177 --- _ctypes.c 29 Oct 2004 19:08:27 -0000 1.178 *************** *** 3724,3728 **** PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL)); PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI)); ! PyModule_AddStringConstant(m, "__version__", "0.9.2"); PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL); --- 3724,3728 ---- PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL)); PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI)); ! PyModule_AddStringConstant(m, "__version__", "0.9.3"); PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL); |
From: Thomas H. <th...@us...> - 2004-10-29 19:08:13
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23146 Modified Files: __init__.py Log Message: Change version number to 0.9.3. Have windows-specific code inside an if block. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** __init__.py 29 Oct 2004 18:53:01 -0000 1.47 --- __init__.py 29 Oct 2004 19:08:03 -0000 1.48 *************** *** 9,13 **** del _magicfile ! __version__ = "0.9.2" from _ctypes import Union, Structure, Array --- 9,13 ---- del _magicfile ! __version__ = "0.9.3" from _ctypes import Union, Structure, Array *************** *** 17,21 **** from _ctypes import ArgumentError - from _ctypes import _check_HRESULT if __version__ != _ctypes_version: --- 17,20 ---- *************** *** 326,329 **** --- 325,329 ---- return func + from _ctypes import _check_HRESULT class HRESULT(c_long): # _check_retval_ is called with the function's result when it |
From: Thomas H. <th...@us...> - 2004-10-29 18:55:06
|
Update of /cvsroot/ctypes/ctypes/win32/com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20444 Modified Files: __init__.py Log Message: HRESULT is now defined in ctypes. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/win32/com/__init__.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** __init__.py 28 Jul 2004 12:46:51 -0000 1.40 --- __init__.py 29 Oct 2004 18:54:55 -0000 1.41 *************** *** 6,10 **** DEBUG = __debug__ # enable debugging output (via Windows' OutputDebugString) ! HRESULT = _ctypes.HRESULT CopyComPointer = _ctypes.CopyComPointer --- 6,11 ---- DEBUG = __debug__ # enable debugging output (via Windows' OutputDebugString) ! from ctypes import HRESULT ! CopyComPointer = _ctypes.CopyComPointer |
From: Thomas H. <th...@us...> - 2004-10-29 18:53:12
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20044 Modified Files: __init__.py Log Message: Define a new protocol for function's restype. If it is a ctypes' type, it is handled in the usual way. But if it additionally has an _check_retval_ attribute, this is called with the result, and the return value of this call is the functions return value. This allows to define HRESULT as a ctypes' type, because it can check for failure in it's _check_retval_ static method, and raise a WindowsError. Although HRESULT is defined in python code (since it is derived from c_long), the _check_retval_ method is implemented in C - in this way the traceback won't include the _check_retval_ method definition itself. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** __init__.py 28 Oct 2004 17:45:37 -0000 1.46 --- __init__.py 29 Oct 2004 18:53:01 -0000 1.47 *************** *** 17,20 **** --- 17,21 ---- from _ctypes import ArgumentError + from _ctypes import _check_HRESULT if __version__ != _ctypes_version: *************** *** 325,333 **** return func ! class OleDLL(CDLL): class _OlecallFuncPtr(_CFuncPtr): _flags_ = _FUNCFLAG_STDCALL | _FUNCFLAG_HRESULT ! _restype_ = c_int # needed, but unused def __getattr__(self, name): if name[:2] == '__' and name[-2:] == '__': --- 326,349 ---- return func ! class HRESULT(c_long): ! # _check_retval_ is called with the function's result when it ! # is used as restype. It checks for the FAILED bit, and ! # raises a WindowsError if it is set. ! # ! # The _check_retval_ method is implemented in C, so that the ! # method definition itself is not included in the traceback ! # when it raises an error - that is what we want (and Python ! # doesn't have a way to raise an exception in the caller's ! # frame. ! _check_retval_ = _check_HRESULT ! class OleDLL(CDLL): class _OlecallFuncPtr(_CFuncPtr): + # It would be possible to remove the _FUNCFLAG_HRESULT + # code, and use HRESULT as _restype_. But + # _FUNCFLAG_HRESULT is used in other places in the C code + # as well, so we leave it as it is. _flags_ = _FUNCFLAG_STDCALL | _FUNCFLAG_HRESULT ! _restype_ = c_int # needed, but unused (see _FUNCFLAG_HRESULT flag) def __getattr__(self, name): if name[:2] == '__' and name[-2:] == '__': |
From: Thomas H. <th...@us...> - 2004-10-29 18:46:49
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18585 Modified Files: callproc.c Log Message: Define a new protocol for function's restype. If it is a ctypes' type, it is handled in the usual way. But if it additionally has an _check_retval_ attribute, this is called with the result, and the return value of this call is the functions return value. This allows to define HRESULT as a ctypes' type, because it can check for failure in it's _check_retval_ static method, and raise a WindowsError. Although HRESULT is defined in python code (since it is derived from c_long), the _check_retval_ method is implemented in C - in this way the traceback won't include the _check_retval_ method definition itself. Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** callproc.c 28 Oct 2004 17:45:50 -0000 1.114 --- callproc.c 29 Oct 2004 18:46:38 -0000 1.115 *************** *** 768,772 **** Is there another way? */ ! PyObject *retval; char c; short s; --- 768,772 ---- Is there another way? */ ! PyObject *retval, *checker; char c; short s; *************** *** 798,802 **** break; } ! return retval; } if (PyCallable_Check(restype)) --- 798,812 ---- break; } ! if (retval == NULL) ! return NULL; ! checker = PyObject_GetAttrString(restype, "_check_retval_"); ! if (checker == NULL) { ! PyErr_Clear(); ! return retval; ! } else { ! PyObject *v = PyObject_CallFunctionObjArgs(checker, retval, NULL); ! Py_DECREF(retval); ! return v; ! } } if (PyCallable_Check(restype)) *************** *** 1418,1421 **** --- 1428,1432 ---- #endif + PyMethodDef module_methods[] = { {"string_at", string_at, METH_VARARGS, string_at_doc}, *************** *** 1433,1437 **** {"FreeLibrary", free_library, METH_VARARGS, free_library_doc}, {"call_commethod", call_commethod, METH_VARARGS }, ! {"HRESULT", check_hresult, METH_VARARGS}, #else {"dlopen", py_dl_open, METH_VARARGS, "dlopen a library"}, --- 1444,1448 ---- {"FreeLibrary", free_library, METH_VARARGS, free_library_doc}, {"call_commethod", call_commethod, METH_VARARGS }, ! {"_check_HRESULT", check_hresult, METH_VARARGS}, #else {"dlopen", py_dl_open, METH_VARARGS, "dlopen a library"}, |
From: Thomas H. <th...@us...> - 2004-10-28 18:44:27
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22812 Modified Files: _ctypes_test.c Log Message: Fix the return type. Index: _ctypes_test.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes_test.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** _ctypes_test.c 25 Oct 2004 10:21:48 -0000 1.36 --- _ctypes_test.c 28 Oct 2004 18:44:15 -0000 1.37 *************** *** 78,82 **** } ! EXPORT(size_t *) my_wcslen(wchar_t *src) { return wcslen(src); --- 78,82 ---- } ! EXPORT(size_t) my_wcslen(wchar_t *src) { return wcslen(src); |
From: Thomas H. <th...@us...> - 2004-10-28 18:41:32
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22027 Modified Files: ANNOUNCE Log Message: 0.9.2 release. Index: ANNOUNCE =================================================================== RCS file: /cvsroot/ctypes/ctypes/ANNOUNCE,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ANNOUNCE 28 Oct 2004 17:45:15 -0000 1.17 --- ANNOUNCE 28 Oct 2004 18:41:16 -0000 1.18 *************** *** 20,23 **** --- 20,28 ---- call and implement custom COM interfaces. + Important + + If you download the source distribution, please choose the ZIP + file for Windows, and the .tar.gz file for other systems. + These archive have different contents! Changes in 0.9.2 |
From: Thomas H. <th...@us...> - 2004-10-28 18:13:37
|
Update of /cvsroot/ctypes/ctypes/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14818 Modified Files: index.stx Log Message: 0.9.2 release. Index: index.stx =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/index.stx,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** index.stx 14 Sep 2004 20:00:40 -0000 1.8 --- index.stx 28 Oct 2004 18:13:15 -0000 1.9 *************** *** 17,33 **** News ! **'ctypes' version 0.9.1 has been released (Sept 14, 2004).** ! ctypes can now call Python API functions (without releasing the ! global interpreter lock). ! Slicing is now supported for array and pointer instances. - Several bugfixes. Detailed changelogs are in CVS (well, sometimes I forget to update them): ! "ANNOUNCE":http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/ANNOUNCE?rev=release_0_9_1 "ChangeLog":http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/ChangeLog?rev=HEAD --- 17,57 ---- News ! **'ctypes' version 0.9.2 has been released (Oct 28, 2004).** ! Fixed several bugs and memory leaks. ! 'ctypes' is now tested on Windows, Linux (x86 and x86_64), OpenBSD ! and Mac OS X. ! ! Implemented some helper functions: 'memmove', 'memset', 'string_at', 'wstring_at'. ! The former act as their C library counterpart, the latter two allow ! to read a zero-terminated (wide) strings at a certain address. ! ! Implemented a 'cast(cobj, ctype)' function, which creates a new object ! of the specified ctype from an existing object. ! ! 'ctypes' now explicitely allocates executable memory for the callbacks ! it creates, this makes it work correctly on platforms where ! executing data is normally forbidden (OpenBSD, Win XP SP2 on AMD 64). ! ! Fixed the unicode handling on non-windows platforms. ! ! Bit fields in structures and unions are now implemented. ! For a bit field, one would specify the width in bits as the third ! part in the '_fields_' list like this:: ! ! class BitFieldSample(Structure): ! _fields_ = [("anInt", c_int), ! ("aBitField", c_int, 3)] ! ! POINTER(None) now returns c_void_p. This change was made for easier ! code generation, and makes sense since 'None' is the ctypes way to ! spell 'void'. Detailed changelogs are in CVS (well, sometimes I forget to update them): ! "ANNOUNCE":http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/ANNOUNCE?rev=release_0_9_2 "ChangeLog":http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/ChangeLog?rev=HEAD |
From: Thomas H. <th...@us...> - 2004-10-28 17:46:12
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8207 Modified Files: callproc.c Log Message: Renamed get_string into string_at, and get_wstring into wstring_at. Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** callproc.c 27 Oct 2004 19:58:56 -0000 1.113 --- callproc.c 28 Oct 2004 17:45:50 -0000 1.114 *************** *** 1364,1374 **** } ! static char get_string_doc[] = ! "get_string(addr[, size]) -> string\n\ \n\ Return the string at addr.\n"; static PyObject * ! get_string(PyObject *self, PyObject *args) { PyObject *result = NULL; --- 1364,1374 ---- } ! static char string_at_doc[] = ! "string_at(addr[, size]) -> string\n\ \n\ Return the string at addr.\n"; static PyObject * ! string_at(PyObject *self, PyObject *args) { PyObject *result = NULL; *************** *** 1391,1401 **** #ifdef CTYPES_UNICODE ! static char get_wstring_doc[] = ! "get_wstring(addr[, size]) -> unicode string\n\ \n\ Return the wide string at addr.\n"; static PyObject * ! get_wstring(PyObject *self, PyObject *args) { PyObject *result = NULL; --- 1391,1401 ---- #ifdef CTYPES_UNICODE ! static char wstring_at_doc[] = ! "wstring_at(addr[, size]) -> unicode string\n\ \n\ Return the wide string at addr.\n"; static PyObject * ! wstring_at(PyObject *self, PyObject *args) { PyObject *result = NULL; *************** *** 1419,1428 **** PyMethodDef module_methods[] = { ! {"get_string", get_string, METH_VARARGS, get_string_doc}, {"memmove", c_memmove, METH_VARARGS, memmove_doc}, {"memset", c_memset, METH_VARARGS, memset_doc}, {"cast", cast, METH_VARARGS, cast_doc}, #ifdef CTYPES_UNICODE ! {"get_wstring", get_wstring, METH_VARARGS, get_wstring_doc}, {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, #endif --- 1419,1428 ---- PyMethodDef module_methods[] = { ! {"string_at", string_at, METH_VARARGS, string_at_doc}, {"memmove", c_memmove, METH_VARARGS, memmove_doc}, {"memset", c_memset, METH_VARARGS, memset_doc}, {"cast", cast, METH_VARARGS, cast_doc}, #ifdef CTYPES_UNICODE ! {"wstring_at", wstring_at, METH_VARARGS, wstring_at_doc}, {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, #endif |