mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-41076: Pre-feed the parser with the f-string expression location (GH-21054)
This commit changes the parsing of f-string expressions with the new parser. The parser gets pre-fed with the location of the expression itself (not the f-string, which was what we were doing before). This allows us to completely skip the shifting of the AST nodes after the parsing is completed.
This commit is contained in:
parent
89e82c4a62
commit
1f0f4abb11
5 changed files with 2437 additions and 2653 deletions
|
|
@ -423,6 +423,9 @@ _PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
|
|||
}
|
||||
}
|
||||
|
||||
if (p->start_rule == Py_fstring_input) {
|
||||
col_offset -= p->starting_col_offset;
|
||||
}
|
||||
Py_ssize_t col_number = col_offset;
|
||||
|
||||
if (p->tok->encoding != NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue