gh-138318, PyREPL: builtins should not be highlighted when used as attribute names (#138319)

This commit is contained in:
yihong 2025-09-08 21:04:22 +08:00 committed by GitHub
parent 921f61bd82
commit 7a3bca50e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 2 deletions

View file

@ -208,7 +208,10 @@ def gen_colors_from_token_stream(
):
span = Span.from_token(token, line_lengths)
yield ColorSpan(span, "soft_keyword")
elif token.string in BUILTINS:
elif (
token.string in BUILTINS
and not (prev_token and prev_token.exact_type == T.DOT)
):
span = Span.from_token(token, line_lengths)
yield ColorSpan(span, "builtin")