GeezerVison is showing github.com — [3.13] gh-146615: Fix format specifiers in Python/ directory (GH-1466… · python/cpython@e726d28
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Python/bltinmodule.c +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2973,7 +2973,7 @@ zip_next(zipobject *lz) | 2973 | 2973 | // ValueError: zip() argument 3 is shorter than arguments 1-2 | 2974 | 2974 | const char* plural = i == 1 ? " " : "s 1-"; | 2975 | 2975 | return PyErr_Format(PyExc_ValueError, | 2976 | | - "zip() argument %d is shorter than argument%s%d", | | 2976 | + "zip() argument %zd is shorter than argument%s%zd", | 2977 | 2977 | i + 1, plural, i); | 2978 | 2978 | } | 2979 | 2979 | for (i = 1; i < tuplesize; i++) { | @@ -2983,7 +2983,7 @@ zip_next(zipobject *lz) | 2983 | 2983 | Py_DECREF(item); | 2984 | 2984 | const char* plural = i == 1 ? " " : "s 1-"; | 2985 | 2985 | return PyErr_Format(PyExc_ValueError, | 2986 | | - "zip() argument %d is longer than argument%s%d", | | 2986 | + "zip() argument %zd is longer than argument%s%zd", | 2987 | 2987 | i + 1, plural, i); | 2988 | 2988 | } | 2989 | 2989 | if (PyErr_Occurred()) { | |
Collapse file Copy file name to clipboardExpand all lines: Python/ceval.c +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -513,7 +513,7 @@ _PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type, | 513 | 513 | if (allowed < nargs) { | 514 | 514 | const char *plural = (allowed == 1) ? "" : "s"; | 515 | 515 | _PyErr_Format(tstate, PyExc_TypeError, | 516 | | - "%s() accepts %d positional sub-pattern%s (%d given)", | | 516 | + "%s() accepts %zd positional sub-pattern%s (%zd given)", | 517 | 517 | ((PyTypeObject*)type)->tp_name, | 518 | 518 | allowed, plural, nargs); | 519 | 519 | goto fail; | @@ -1183,7 +1183,7 @@ format_missing(PyThreadState *tstate, const char *kind, | 1183 | 1183 | if (name_str == NULL) | 1184 | 1184 | return; | 1185 | 1185 | _PyErr_Format(tstate, PyExc_TypeError, | 1186 | | - "%U() missing %i required %s argument%s: %U", | | 1186 | + "%U() missing %zd required %s argument%s: %U", | 1187 | 1187 | qualname, | 1188 | 1188 | len, | 1189 | 1189 | kind, | |
Collapse file Copy file name to clipboardExpand all lines: Python/getargs.c +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2189,7 +2189,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, | 2189 | 2189 | if (i < parser->min) { | 2190 | 2190 | /* Less arguments than required */ | 2191 | 2191 | if (i < pos) { | 2192 | | - Py_ssize_t min = Py_MIN(pos, parser->min); | | 2192 | + int min = Py_MIN(pos, parser->min); | 2193 | 2193 | PyErr_Format(PyExc_TypeError, | 2194 | 2194 | "%.200s%s takes %s %d positional argument%s" | 2195 | 2195 | " (%zd given)", | @@ -2203,7 +2203,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, | 2203 | 2203 | else { | 2204 | 2204 | keyword = PyTuple_GET_ITEM(kwtuple, i - pos); | 2205 | 2205 | PyErr_Format(PyExc_TypeError, "%.200s%s missing required " | 2206 | | - "argument '%U' (pos %d)", | | 2206 | + "argument '%U' (pos %zd)", | 2207 | 2207 | (parser->fname == NULL) ? "function" : parser->fname, | 2208 | 2208 | (parser->fname == NULL) ? "" : "()", | 2209 | 2209 | keyword, i+1); | @@ -2244,7 +2244,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, | 2244 | 2244 | /* arg present in tuple and in dict */ | 2245 | 2245 | PyErr_Format(PyExc_TypeError, | 2246 | 2246 | "argument for %.200s%s given by name ('%U') " | 2247 | | - "and position (%d)", | | 2247 | + "and position (%zd)", | 2248 | 2248 | (parser->fname == NULL) ? "function" : parser->fname, | 2249 | 2249 | (parser->fname == NULL) ? "" : "()", | 2250 | 2250 | keyword, i+1); | |
Collapse file Copy file name to clipboardExpand all lines: Python/interpconfig.c +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -207,7 +207,7 @@ interp_config_from_dict(PyObject *origdict, PyInterpreterConfig *config, | 207 | 207 | } | 208 | 208 | else if (unused > 0) { | 209 | 209 | PyErr_Format(PyExc_ValueError, | 210 | | - "config dict has %d extra items (%R)", unused, dict); | | 210 | + "config dict has %zd extra items (%R)", unused, dict); | 211 | 211 | goto error; | 212 | 212 | } | 213 | 213 |
| |
Collapse file Copy file name to clipboardExpand all lines: Python/pythonrun.c +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1398,11 +1398,11 @@ get_interactive_filename(PyObject *filename, Py_ssize_t count) | 1398 | 1398 | if (middle == NULL) { | 1399 | 1399 | return NULL; | 1400 | 1400 | } | 1401 | | - result = PyUnicode_FromFormat("<%U-%d>", middle, count); | | 1401 | + result = PyUnicode_FromFormat("<%U-%zd>", middle, count); | 1402 | 1402 | Py_DECREF(middle); | 1403 | 1403 | } else { | 1404 | 1404 | result = PyUnicode_FromFormat( | 1405 | | - "%U-%d", filename, count); | | 1405 | + "%U-%zd", filename, count); | 1406 | 1406 | } | 1407 | 1407 | return result; | 1408 | 1408 |
| |
|