Skip to content

Commit

Permalink
python: fix small issue in f-string parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuDartiailh committed Nov 13, 2023
1 parent a3e017f commit 8283a16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions data/python.gram
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,10 @@ class Parser(Parser):
end = last_token.start
if (
sys.version_info >= (3, 12)
or (sys.version_info >= (3, 11)
and last_token.type != 4
or (
sys.version_info >= (3, 11)
and last_token.type != 4
)
): # i.e. not a \n
end = last_token.end
self.raise_raw_syntax_error(
Expand Down
2 changes: 1 addition & 1 deletion tests/python_parser/data/fstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@


f'{expr:}'

f'{expr:d}'
foo = 3.14159
verbosePrint(f'Foo {foo:.3} bar.')

0 comments on commit 8283a16

Please sign in to comment.