Skip to content

Commit 01779db

Browse files
author
LiuYinCarl
committed
fix backslash in f-string
1 parent 468aa22 commit 01779db

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

coverage/phystokens.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ def _phys_tokens(toks: TokenInfos) -> TokenInfos:
6969
# It's a multi-line string and the first line ends with
7070
# a backslash, so we don't need to inject another.
7171
inject_backslash = False
72+
elif sys.version_info >= (3, 12) and ttype == token.FSTRING_MIDDLE:
73+
if ttext.split("\n", 1)[0][-1] == "\\":
74+
inject_backslash = False
7275
if inject_backslash:
7376
# Figure out what column the backslash is in.
7477
ccol = len(last_line.split("\n")[-2]) - 1

0 commit comments

Comments
 (0)