diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-03-13 20:59:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-13 20:59:55 (GMT) |
commit | d53fe5f407ff4b529628b01a1bcbf21a6aad5c3a (patch) | |
tree | db8a8657e379e60b26fe2bfdbad4da612fbb46b9 /Python/getargs.c | |
parent | 10f8ce66884cd7fee2372b8dae08ca8132091574 (diff) | |
download | cpython-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 'Python/getargs.c')
-rw-r--r-- | Python/getargs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index ba1a9d4..876f5c7 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -372,14 +372,14 @@ vgetargs1_impl(PyObject *compat_args, PyObject *const *stack, Py_ssize_t nargs, if (nargs < min || max < nargs) { if (message == NULL) PyErr_Format(PyExc_TypeError, - "%.150s%s takes %s %d argument%s (%ld given)", + "%.150s%s takes %s %d argument%s (%zd given)", fname==NULL ? "function" : fname, fname==NULL ? "" : "()", min==max ? "exactly" : nargs < min ? "at least" : "at most", nargs < min ? min : max, (nargs < min ? min : max) == 1 ? "" : "s", - Py_SAFE_DOWNCAST(nargs, Py_ssize_t, long)); + nargs); else PyErr_SetString(PyExc_TypeError, message); return cleanreturn(0, &freelist); @@ -1741,7 +1741,7 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format, else { PyErr_Format(PyExc_TypeError, "%.200s%s takes %s %d positional argument%s" - " (%d given)", + " (%zd given)", (fname == NULL) ? "function" : fname, (fname == NULL) ? "" : "()", (min != INT_MAX) ? "at most" : "exactly", @@ -1826,7 +1826,7 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format, if (skip) { PyErr_Format(PyExc_TypeError, "%.200s%s takes %s %d positional argument%s" - " (%d given)", + " (%zd given)", (fname == NULL) ? "function" : fname, (fname == NULL) ? "" : "()", (Py_MIN(pos, min) < i) ? "at least" : "exactly", @@ -2194,7 +2194,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, Py_ssize_t min = Py_MIN(pos, parser->min); PyErr_Format(PyExc_TypeError, "%.200s%s takes %s %d positional argument%s" - " (%d given)", + " (%zd given)", (parser->fname == NULL) ? "function" : parser->fname, (parser->fname == NULL) ? "" : "()", min < parser->max ? "at least" : "exactly", |