summaryrefslogtreecommitdiffstats
path: root/Objects
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 /Objects
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 'Objects')
-rw-r--r--Objects/bytesobject.c2
-rw-r--r--Objects/odictobject.c4
-rw-r--r--Objects/structseq.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index b299d48..0b46cee 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -1210,7 +1210,7 @@ PyObject *_PyBytes_DecodeEscape(const char *s,
if (!errors || strcmp(errors, "strict") == 0) {
PyErr_Format(PyExc_ValueError,
- "invalid \\x escape at position %d",
+ "invalid \\x escape at position %zd",
s - 2 - (end - len));
goto failed;
}
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index 767eb5f..6c75a42 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -1539,7 +1539,7 @@ odict_init(PyObject *self, PyObject *args, PyObject *kwds)
if (len == -1)
return -1;
if (len > 1) {
- const char *msg = "expected at most 1 arguments, got %d";
+ const char *msg = "expected at most 1 arguments, got %zd";
PyErr_Format(PyExc_TypeError, msg, len);
return -1;
}
@@ -2213,7 +2213,7 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
assert(args == NULL || PyTuple_Check(args));
len = (args != NULL) ? PyTuple_GET_SIZE(args) : 0;
if (len > 1) {
- const char *msg = "update() takes at most 1 positional argument (%d given)";
+ const char *msg = "update() takes at most 1 positional argument (%zd given)";
PyErr_Format(PyExc_TypeError, msg, len);
return NULL;
}
diff --git a/Objects/structseq.c b/Objects/structseq.c
index 56b06c7..1c37845 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -195,7 +195,7 @@ structseq_repr(PyStructSequence *obj)
cname = typ->tp_members[i].name;
if (cname == NULL) {
- PyErr_Format(PyExc_SystemError, "In structseq_repr(), member %d name is NULL"
+ PyErr_Format(PyExc_SystemError, "In structseq_repr(), member %zd name is NULL"
" for type %.500s", i, typ->tp_name);
return NULL;
}