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

gh-138318, PyREPL: builtins should not be highlighted when used as attribute names (GH-138319)
(cherry picked from commit 7a3bca50e0)

Co-authored-by: yihong <zouzou0208@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-09-08 15:29:53 +02:00 committed by GitHub
parent 5074241f3d
commit 655ad1c63e
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")