Update of /cvsroot/ctypes/ctypes/source
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4485
Modified Files:
_ctypes.c
Log Message:
Fix some Py_ssize_t issues, change version to 0.9.9.7.
Index: _ctypes.c
===================================================================
RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v
retrieving revision 1.329
retrieving revision 1.330
diff -C2 -d -r1.329 -r1.330
*** _ctypes.c 19 May 2006 19:21:01 -0000 1.329
--- _ctypes.c 19 May 2006 20:05:42 -0000 1.330
***************
*** 345,349 ****
--- 345,353 ----
if (length < 0)
return PyErr_Format(PyExc_ValueError,
+ #if (PY_VERSION_HEX < 0x02050000)
"Array length must be >= 0, not %d",
+ #else
+ "Array length must be >= 0, not %zd",
+ #endif
length);
return CreateArrayType(self, length);
***************
*** 1821,1825 ****
--- 1825,1833 ----
assert(sizeof(string) - 1 > sizeof(Py_ssize_t) * 2);
+ #if (PY_VERSION_HEX < 0x02050000)
+ cp += sprintf(cp, "%zx", index);
+ #else
cp += sprintf(cp, "%x", index);
+ #endif
while (target->b_base) {
bytes_left = sizeof(string) - (cp - string) - 1;
***************
*** 1830,1834 ****
--- 1838,1846 ----
return NULL;
}
+ #if (PY_VERSION_HEX < 0x02050000)
cp += sprintf(cp, ":%x", target->b_index);
+ #else
+ cp += sprintf(cp, ":%zx", target->b_index);
+ #endif
target = target->b_base;
}
***************
*** 4621,4625 ****
PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL));
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI));
! PyModule_AddStringConstant(m, "__version__", "0.9.9.6");
PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
--- 4633,4637 ----
PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL));
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI));
! PyModule_AddStringConstant(m, "__version__", "0.9.9.7");
PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
|