GeezerVison is showing github.com — gh-146615: Fix format specifiers in Python/ directory (GH-146619) · python/cpython@dcb260e
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 +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1607,7 +1607,7 @@ map_next(PyObject *self) | 1607 | 1607 | // ValueError: map() argument 3 is shorter than arguments 1-2 | 1608 | 1608 | const char* plural = i == 1 ? " " : "s 1-"; | 1609 | 1609 | PyErr_Format(PyExc_ValueError, | 1610 | | - "map() argument %d is shorter than argument%s%d", | | 1610 | + "map() argument %zd is shorter than argument%s%zd", | 1611 | 1611 | i + 1, plural, i); | 1612 | 1612 | goto exit_no_result; | 1613 | 1613 | } | @@ -1618,7 +1618,7 @@ map_next(PyObject *self) | 1618 | 1618 | Py_DECREF(val); | 1619 | 1619 | const char* plural = i == 1 ? " " : "s 1-"; | 1620 | 1620 | PyErr_Format(PyExc_ValueError, | 1621 | | - "map() argument %d is longer than argument%s%d", | | 1621 | + "map() argument %zd is longer than argument%s%zd", | 1622 | 1622 | i + 1, plural, i); | 1623 | 1623 | goto exit_no_result; | 1624 | 1624 | } | @@ -3307,7 +3307,7 @@ zip_next(PyObject *self) | 3307 | 3307 | // ValueError: zip() argument 3 is shorter than arguments 1-2 | 3308 | 3308 | const char* plural = i == 1 ? " " : "s 1-"; | 3309 | 3309 | return PyErr_Format(PyExc_ValueError, | 3310 | | - "zip() argument %d is shorter than argument%s%d", | | 3310 | + "zip() argument %zd is shorter than argument%s%zd", | 3311 | 3311 | i + 1, plural, i); | 3312 | 3312 | } | 3313 | 3313 | for (i = 1; i < tuplesize; i++) { | @@ -3317,7 +3317,7 @@ zip_next(PyObject *self) | 3317 | 3317 | Py_DECREF(item); | 3318 | 3318 | const char* plural = i == 1 ? " " : "s 1-"; | 3319 | 3319 | return PyErr_Format(PyExc_ValueError, | 3320 | | - "zip() argument %d is longer than argument%s%d", | | 3320 | + "zip() argument %zd is longer than argument%s%zd", | 3321 | 3321 | i + 1, plural, i); | 3322 | 3322 | } | 3323 | 3323 | 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 |
|---|
@@ -602,7 +602,7 @@ _PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type, | 602 | 602 | if (allowed < nargs) { | 603 | 603 | const char *plural = (allowed == 1) ? "" : "s"; | 604 | 604 | _PyErr_Format(tstate, PyExc_TypeError, | 605 | | - "%s() accepts %d positional sub-pattern%s (%d given)", | | 605 | + "%s() accepts %zd positional sub-pattern%s (%zd given)", | 606 | 606 | ((PyTypeObject*)type)->tp_name, | 607 | 607 | allowed, plural, nargs); | 608 | 608 | goto fail; | @@ -1555,7 +1555,7 @@ format_missing(PyThreadState *tstate, const char *kind, | 1555 | 1555 | if (name_str == NULL) | 1556 | 1556 | return; | 1557 | 1557 | _PyErr_Format(tstate, PyExc_TypeError, | 1558 | | - "%U() missing %i required %s argument%s: %U", | | 1558 | + "%U() missing %zd required %s argument%s: %U", | 1559 | 1559 | qualname, | 1560 | 1560 | len, | 1561 | 1561 | kind, | |
Collapse file Copy file name to clipboardExpand all lines: Python/crossinterp_data_lookup.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -455,7 +455,7 @@ _PyBytes_GetXIDataWrapped(PyThreadState *tstate, | 455 | 455 | return NULL; | 456 | 456 | } | 457 | 457 | if (size < sizeof(_PyBytes_data_t)) { | 458 | | - PyErr_Format(PyExc_ValueError, "expected size >= %d, got %d", | | 458 | + PyErr_Format(PyExc_ValueError, "expected size >= %zu, got %zu", | 459 | 459 | sizeof(_PyBytes_data_t), size); | 460 | 460 | return NULL; | 461 | 461 | } | |
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 |
|---|
@@ -2421,7 +2421,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, | 2421 | 2421 | if (i < parser->min) { | 2422 | 2422 | /* Less arguments than required */ | 2423 | 2423 | if (i < pos) { | 2424 | | - Py_ssize_t min = Py_MIN(pos, parser->min); | | 2424 | + int min = Py_MIN(pos, parser->min); | 2425 | 2425 | PyErr_Format(PyExc_TypeError, | 2426 | 2426 | "%.200s%s takes %s %d positional argument%s" | 2427 | 2427 | " (%zd given)", | @@ -2435,7 +2435,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, | 2435 | 2435 | else { | 2436 | 2436 | keyword = PyTuple_GET_ITEM(kwtuple, i - pos); | 2437 | 2437 | PyErr_Format(PyExc_TypeError, "%.200s%s missing required " | 2438 | | - "argument '%U' (pos %d)", | | 2438 | + "argument '%U' (pos %zd)", | 2439 | 2439 | (parser->fname == NULL) ? "function" : parser->fname, | 2440 | 2440 | (parser->fname == NULL) ? "" : "()", | 2441 | 2441 | keyword, i+1); | @@ -2476,7 +2476,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs, | 2476 | 2476 | /* arg present in tuple and in dict */ | 2477 | 2477 | PyErr_Format(PyExc_TypeError, | 2478 | 2478 | "argument for %.200s%s given by name ('%U') " | 2479 | | - "and position (%d)", | | 2479 | + "and position (%zd)", | 2480 | 2480 | (parser->fname == NULL) ? "function" : parser->fname, | 2481 | 2481 | (parser->fname == NULL) ? "" : "()", | 2482 | 2482 | 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 |
|---|
@@ -208,7 +208,7 @@ interp_config_from_dict(PyObject *origdict, PyInterpreterConfig *config, | 208 | 208 | } | 209 | 209 | else if (unused > 0) { | 210 | 210 | PyErr_Format(PyExc_ValueError, | 211 | | - "config dict has %d extra items (%R)", unused, dict); | | 211 | + "config dict has %zd extra items (%R)", unused, dict); | 212 | 212 | goto error; | 213 | 213 | } | 214 | 214 |
| |
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 |
|---|
@@ -1382,11 +1382,11 @@ get_interactive_filename(PyObject *filename, Py_ssize_t count) | 1382 | 1382 | if (middle == NULL) { | 1383 | 1383 | return NULL; | 1384 | 1384 | } | 1385 | | - result = PyUnicode_FromFormat("<%U-%d>", middle, count); | | 1385 | + result = PyUnicode_FromFormat("<%U-%zd>", middle, count); | 1386 | 1386 | Py_DECREF(middle); | 1387 | 1387 | } else { | 1388 | 1388 | result = PyUnicode_FromFormat( | 1389 | | - "%U-%d", filename, count); | | 1389 | + "%U-%zd", filename, count); | 1390 | 1390 | } | 1391 | 1391 | return result; | 1392 | 1392 |
| |
|