diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-06-15 00:36:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-15 00:36:40 (GMT) |
commit | 638c2bacde87abbcc7dc067564941d707aed788c (patch) | |
tree | 0636f8cade1897d9393ff393b34e2bf7f7ac1b45 /Parser/action_helpers.c | |
parent | 52a2bbdc9d6d62bad34d9bc42db613ea498ded1a (diff) | |
download | cpython-638c2bacde87abbcc7dc067564941d707aed788c.zip cpython-638c2bacde87abbcc7dc067564941d707aed788c.tar.gz cpython-638c2bacde87abbcc7dc067564941d707aed788c.tar.bz2 |
[3.12] gh-105800: Issue SyntaxWarning in f-strings for invalid escape sequences (GH-105801) (#105806)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Parser/action_helpers.c')
-rw-r--r-- | Parser/action_helpers.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Parser/action_helpers.c b/Parser/action_helpers.c index 9f51353..dbad56b 100644 --- a/Parser/action_helpers.c +++ b/Parser/action_helpers.c @@ -1231,7 +1231,7 @@ _PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args, asdl_comprehension_seq // Fstring stuff static expr_ty -_PyPegen_decode_fstring_part(Parser* p, int is_raw, expr_ty constant) { +_PyPegen_decode_fstring_part(Parser* p, int is_raw, expr_ty constant, Token* token) { assert(PyUnicode_CheckExact(constant->v.Constant.value)); const char* bstr = PyUnicode_AsUTF8(constant->v.Constant.value); @@ -1247,7 +1247,7 @@ _PyPegen_decode_fstring_part(Parser* p, int is_raw, expr_ty constant) { } is_raw = is_raw || strchr(bstr, '\\') == NULL; - PyObject *str = _PyPegen_decode_string(p, is_raw, bstr, len, NULL); + PyObject *str = _PyPegen_decode_string(p, is_raw, bstr, len, token); if (str == NULL) { _Pypegen_raise_decode_error(p); return NULL; @@ -1321,7 +1321,7 @@ _PyPegen_joined_str(Parser *p, Token* a, asdl_expr_seq* raw_expressions, Token*b for (Py_ssize_t i = 0; i < n_items; i++) { expr_ty item = asdl_seq_GET(expr, i); if (item->kind == Constant_kind) { - item = _PyPegen_decode_fstring_part(p, is_raw, item); + item = _PyPegen_decode_fstring_part(p, is_raw, item, b); if (item == NULL) { return NULL; } |