diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-03-14 10:47:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-14 10:47:27 +0200 |
commit | 783bed4c8daf65a2893d94761ea44af4e3718f4f (patch) | |
tree | cf5ce9cca23905968219200014eef4e7506b7563 /Objects | |
parent | a84f9bc11c3ce4854f7b4e16f3cb3cca954092f6 (diff) | |
download | cpython-git-783bed4c8daf65a2893d94761ea44af4e3718f4f.tar.gz |
[3.7] bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264). (GH-12322)
(cherry picked from commit d53fe5f407ff4b529628b01a1bcbf21a6aad5c3a)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytesobject.c | 2 | ||||
-rw-r--r-- | Objects/odictobject.c | 4 | ||||
-rw-r--r-- | Objects/structseq.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 172c7f38b9..a5319da48d 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -1209,7 +1209,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 7487bd9607..88afc61f60 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -1538,7 +1538,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; } @@ -2211,7 +2211,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 1b71f724a6..900aaba7c1 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -194,7 +194,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; } |