Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed May 3, 2023
1 parent e9678f4 commit 2601427
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/blib2to3/pgen2/tokenize.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def generate_tokens(
if token[-1] == "\n": # continued string
strstart = (lnum, start)
maybe_endprog = (
endprogs[initial]
endprogs.get(initial)
or endprogs.get(token[1])
or endprogs.get(token[2])
)
Expand Down
4 changes: 4 additions & 0 deletions tests/data/simple_cases/fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
f"\"{f'{nested} inner'}\" outer"
f"space between opening braces: { {a for a in (1, 2, 3)}}"
f'Hello \'{tricky + "example"}\''
f"Tried directories {str(rootdirs)} \
but none started with prefix {parentdir_prefix}"

# output

Expand All @@ -19,3 +21,5 @@
f"\"{f'{nested} inner'}\" outer"
f"space between opening braces: { {a for a in (1, 2, 3)}}"
f'Hello \'{tricky + "example"}\''
f"Tried directories {str(rootdirs)} \
but none started with prefix {parentdir_prefix}"

0 comments on commit 2601427

Please sign in to comment.