Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-134158: Fix PyREPL coloring of double braces in f/t-strings#134159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
Minor adjustments
  • Loading branch information
@ambv
ambv committedMay 19, 2025
commit28c305a1d4911f62dcfe98bfe5d2f8ece6d96e5c
12 changes: 5 additions & 7 deletionsLib/_pyrepl/utils.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,17 +41,15 @@ def from_re(cls, m: Match[str], group: int | str) -> Self:

@classmethod
def from_token(cls, token: TI, line_len: list[int]) -> Self:
end_offset =0
if ((token.typeisT.FSTRING_MIDDLE or token.type isT.TSTRING_MIDDLE)
end_offset =-1
if (token.typein {T.FSTRING_MIDDLE,T.TSTRING_MIDDLE}
and token.string.endswith(("{", "}"))):
# Double braces in f-string / t-string are translated into a single
# brace by the tokenizer, and are always at the end of the token:
# we must add 1 to the token end position to color the two braces.
end_offset = 1
# gh-134158: a visible trailing brace comes from a double brace in input
end_offset += 1

return cls(
line_len[token.start[0] - 1] + token.start[1],
line_len[token.end[0] - 1] + token.end[1]- 1+ end_offset,
line_len[token.end[0] - 1] + token.end[1] + end_offset,
)


Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp