Index: Modules/_ctypes/callproc.c =================================================================== --- Modules/_ctypes/callproc.c (revision 54885) +++ Modules/_ctypes/callproc.c (working copy) @@ -1126,7 +1126,7 @@ static PyObject *free_library(PyObject *self, PyObject *args) { HMODULE hMod; - if (!PyArg_ParseTuple(args, "i:FreeLibrary", &hMod)) + if (!PyArg_ParseTuple(args, PY_SSIZE_T_CODE ":FreeLibrary", &hMod)) return NULL; if (!FreeLibrary(hMod)) return PyErr_SetFromWindowsErr(GetLastError()); @@ -1247,9 +1247,9 @@ static PyObject *py_dl_close(PyObject *self, PyObject *args) { - int handle; + Py_ssize_t handle; - if (!PyArg_ParseTuple(args, "i:dlclose", &handle)) + if (!PyArg_ParseTuple(args, PY_SSIZE_T_CODE ":dlclose", &handle)) return NULL; if (dlclose((void*)handle)) { PyErr_SetString(PyExc_OSError, @@ -1263,10 +1263,10 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args) { char *name; - int handle; + Py_ssize_t handle; void *ptr; - if (!PyArg_ParseTuple(args, "is:dlsym", &handle, &name)) + if (!PyArg_ParseTuple(args, PY_SSIZE_T_CODE "s:dlsym", &handle, &name)) return NULL; ptr = ctypes_dlsym((void*)handle, name); if (!ptr) { @@ -1286,12 +1286,12 @@ static PyObject * call_function(PyObject *self, PyObject *args) { - int func; + Py_ssize_t func; PyObject *arguments; PyObject *result; if (!PyArg_ParseTuple(args, - "iO!", + PY_SSIZE_T_CODE "O!", &func, &PyTuple_Type, &arguments)) return NULL; @@ -1317,12 +1317,12 @@ static PyObject * call_cdeclfunction(PyObject *self, PyObject *args) { - int func; + Py_ssize_t func; PyObject *arguments; PyObject *result; if (!PyArg_ParseTuple(args, - "iO!", + PY_SSIZE_T_CODE "O!", &func, &PyTuple_Type, &arguments)) return NULL; Index: Modules/_ctypes/ctypes.h =================================================================== --- Modules/_ctypes/ctypes.h (revision 54885) +++ Modules/_ctypes/ctypes.h (working copy) @@ -4,6 +4,9 @@ #if (PY_VERSION_HEX < 0x02050000) typedef int Py_ssize_t; +#define PY_SSIZE_T_CODE "i" +#else +#define PY_SSIZE_T_CODE "n" #endif #ifndef MS_WIN32