Skip to content

Commit c0eae2a

Browse files
authored
[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.
1 parent 01af34a commit c0eae2a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Parser/lexer/lexer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ tok_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct t
11061106
tokenizer_mode *the_current_tok = TOK_GET_MODE(tok);
11071107
if (the_current_tok->f_string_quote == quote &&
11081108
the_current_tok->f_string_quote_size == quote_size) {
1109-
return MAKE_TOKEN(_PyTokenizer_syntaxerror(tok, "f-string: expecting '}'", start));
1109+
return MAKE_TOKEN(_PyTokenizer_syntaxerror(tok, "f-string: expecting '}'"));
11101110
}
11111111
}
11121112

Python/getargs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,7 +2203,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs,
22032203
else {
22042204
keyword = PyTuple_GET_ITEM(kwtuple, i - pos);
22052205
PyErr_Format(PyExc_TypeError, "%.200s%s missing required "
2206-
"argument '%U' (pos %zd)",
2206+
"argument '%U' (pos %d)",
22072207
(parser->fname == NULL) ? "function" : parser->fname,
22082208
(parser->fname == NULL) ? "" : "()",
22092209
keyword, i+1);
@@ -2244,7 +2244,7 @@ vgetargskeywordsfast_impl(PyObject *const *args, Py_ssize_t nargs,
22442244
/* arg present in tuple and in dict */
22452245
PyErr_Format(PyExc_TypeError,
22462246
"argument for %.200s%s given by name ('%U') "
2247-
"and position (%zd)",
2247+
"and position (%d)",
22482248
(parser->fname == NULL) ? "function" : parser->fname,
22492249
(parser->fname == NULL) ? "" : "()",
22502250
keyword, i+1);

0 commit comments

Comments
 (0)