https://github.com/python/cpython/commit/c0eae2a1c3884222082dda81a53c6dd1130a114a
commit: c0eae2a1c3884222082dda81a53c6dd1130a114a
branch: 3.13
author: sunmy2019 <[email protected]>
committer: vstinner <[email protected]>
date: 2026-04-01T21:52:14Z
summary:

[3.13] gh-146615: Fix format specifiers in Objects/ directory (GH-146620)  
(#147705)

* Fix format specifiers in vgetargskeywordsfast_impl for improved error 
messages.
* Fix f-string syntax error message in tok_get_normal_mode.

files:
M Parser/lexer/lexer.c
M Python/getargs.c

diff --git a/Parser/lexer/lexer.c b/Parser/lexer/lexer.c
index cc89f0b9cc9af0..dd5f9e7a8d1ea6 100644
--- a/Parser/lexer/lexer.c
+++ b/Parser/lexer/lexer.c
@@ -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 '}'"));
                     }
                 }
 
diff --git a/Python/getargs.c b/Python/getargs.c
index 1bf99fe33c8a35..13e0ae7c1675a0 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -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);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to