]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-146615: Fix format specifiers in Objects/ directory (GH-146620) (#147705)
authorsunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Wed, 1 Apr 2026 21:52:14 +0000 (05:52 +0800)
committerGitHub <noreply@github.com>
Wed, 1 Apr 2026 21:52:14 +0000 (21:52 +0000)
* Fix format specifiers in vgetargskeywordsfast_impl for improved error messages.
* Fix f-string syntax error message in tok_get_normal_mode.

Parser/lexer/lexer.c
Python/getargs.c

index cc89f0b9cc9af05c025abe622cb4c6c4d7c5d045..dd5f9e7a8d1ea6ff02170128805507b12a434ee8 100644 (file)
@@ -1106,7 +1106,7 @@ tok_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct t
                     tokenizer_mode *the_current_tok = TOK_GET_MODE(tok);
                     if (the_current_tok->f_string_quote == quote &&
                         the_current_tok->f_string_quote_size == quote_size) {
-                        return MAKE_TOKEN(_PyTokenizer_syntaxerror(tok, "f-string: expecting '}'", start));
+                        return MAKE_TOKEN(_PyTokenizer_syntaxerror(tok, "f-string: expecting '}'"));
                     }
                 }
 
index 1bf99fe33c8a3590ff18174994c6e3dc4e58a58b..13e0ae7c1675a060d5ab132343447aaa05bbb94e 100644 (file)
@@ -2203,7 +2203,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs,
             else {
                 keyword = PyTuple_GET_ITEM(kwtuple, i - pos);
                 PyErr_Format(PyExc_TypeError,  "%.200s%s missing required "
-                             "argument '%U' (pos %zd)",
+                             "argument '%U' (pos %d)",
                              (parser->fname == NULL) ? "function" : parser->fname,
                              (parser->fname == NULL) ? "" : "()",
                              keyword, i+1);
@@ -2244,7 +2244,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs,
                 /* arg present in tuple and in dict */
                 PyErr_Format(PyExc_TypeError,
                              "argument for %.200s%s given by name ('%U') "
-                             "and position (%zd)",
+                             "and position (%d)",
                              (parser->fname == NULL) ? "function" : parser->fname,
                              (parser->fname == NULL) ? "" : "()",
                              keyword, i+1);