summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-03-13 20:59:55 (GMT)
committerGitHub <noreply@github.com>2019-03-13 20:59:55 (GMT)
commitd53fe5f407ff4b529628b01a1bcbf21a6aad5c3a (patch)
treedb8a8657e379e60b26fe2bfdbad4da612fbb46b9 /Modules/_ctypes
parent10f8ce66884cd7fee2372b8dae08ca8132091574 (diff)
downloadcpython-d53fe5f407ff4b529628b01a1bcbf21a6aad5c3a.zip
cpython-d53fe5f407ff4b529628b01a1bcbf21a6aad5c3a.tar.gz
cpython-d53fe5f407ff4b529628b01a1bcbf21a6aad5c3a.tar.bz2
bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264)
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/callbacks.c10
-rw-r--r--Modules/_ctypes/callproc.c6
-rw-r--r--Modules/_ctypes/malloc_closure.c2
3 files changed, 9 insertions, 9 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index c1e9b72..2b7cb06 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -165,14 +165,14 @@ static void _CallPythonObject(void *mem,
if (cnv)
dict = PyType_stgdict(cnv);
else {
- PrintError("Getting argument converter %d\n", i);
+ PrintError("Getting argument converter %zd\n", i);
goto Done;
}
if (dict && dict->getfunc && !_ctypes_simple_instance(cnv)) {
PyObject *v = dict->getfunc(*pArgs, dict->size);
if (!v) {
- PrintError("create argument %d:\n", i);
+ PrintError("create argument %zd:\n", i);
Py_DECREF(cnv);
goto Done;
}
@@ -186,14 +186,14 @@ static void _CallPythonObject(void *mem,
/* Hm, shouldn't we use PyCData_AtAddress() or something like that instead? */
CDataObject *obj = (CDataObject *)_PyObject_CallNoArg(cnv);
if (!obj) {
- PrintError("create argument %d:\n", i);
+ PrintError("create argument %zd:\n", i);
Py_DECREF(cnv);
goto Done;
}
if (!CDataObject_Check(obj)) {
Py_DECREF(obj);
Py_DECREF(cnv);
- PrintError("unexpected result of create argument %d:\n", i);
+ PrintError("unexpected result of create argument %zd:\n", i);
goto Done;
}
memcpy(obj->b_ptr, *pArgs, dict->size);
@@ -204,7 +204,7 @@ static void _CallPythonObject(void *mem,
} else {
PyErr_SetString(PyExc_TypeError,
"cannot build parameter");
- PrintError("Parsing argument %d\n", i);
+ PrintError("Parsing argument %zd\n", i);
Py_DECREF(cnv);
goto Done;
}
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 9bcc955..d91e846 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -1131,20 +1131,20 @@ PyObject *_ctypes_callproc(PPROC pProc,
converter = PyTuple_GET_ITEM(argtypes, i);
v = PyObject_CallFunctionObjArgs(converter, arg, NULL);
if (v == NULL) {
- _ctypes_extend_error(PyExc_ArgError, "argument %d: ", i+1);
+ _ctypes_extend_error(PyExc_ArgError, "argument %zd: ", i+1);
goto cleanup;
}
err = ConvParam(v, i+1, pa);
Py_DECREF(v);
if (-1 == err) {
- _ctypes_extend_error(PyExc_ArgError, "argument %d: ", i+1);
+ _ctypes_extend_error(PyExc_ArgError, "argument %zd: ", i+1);
goto cleanup;
}
} else {
err = ConvParam(arg, i+1, pa);
if (-1 == err) {
- _ctypes_extend_error(PyExc_ArgError, "argument %d: ", i+1);
+ _ctypes_extend_error(PyExc_ArgError, "argument %zd: ", i+1);
goto cleanup; /* leaking ? */
}
}
diff --git a/Modules/_ctypes/malloc_closure.c b/Modules/_ctypes/malloc_closure.c
index 248c6a6..8ad7649 100644
--- a/Modules/_ctypes/malloc_closure.c
+++ b/Modules/_ctypes/malloc_closure.c
@@ -76,7 +76,7 @@ static void more_core(void)
#ifdef MALLOC_CLOSURE_DEBUG
printf("block at %p allocated (%d bytes), %d ITEMs\n",
- item, count * sizeof(ITEM), count);
+ item, count * (int)sizeof(ITEM), count);
#endif
/* put them into the free list */
for (i = 0; i < count; ++i) {