https://github.com/python/cpython/commit/1fd66eadd258223a0e3446b5b23ff2303294112c
commit: 1fd66eadd258223a0e3446b5b23ff2303294112c
branch: main
author: Pieter Eendebak <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-03-28T20:21:19Z
summary:

gh-139003: Use frozenset for module level attributes in _pyrepl.utils (#139004)

Use frozenset for module level attributes

files:
M Lib/_pyrepl/utils.py

diff --git a/Lib/_pyrepl/utils.py b/Lib/_pyrepl/utils.py
index 25d7ac1bd0b14e..7175d57a9e319e 100644
--- a/Lib/_pyrepl/utils.py
+++ b/Lib/_pyrepl/utils.py
@@ -19,9 +19,9 @@
 ANSI_ESCAPE_SEQUENCE = re.compile(r"\x1b\[[ -@]*[A-~]")
 ZERO_WIDTH_BRACKET = re.compile(r"\x01.*?\x02")
 ZERO_WIDTH_TRANS = str.maketrans({"\x01": "", "\x02": ""})
-IDENTIFIERS_AFTER = {"def", "class"}
-KEYWORD_CONSTANTS = {"True", "False", "None"}
-BUILTINS = {str(name) for name in dir(builtins) if not name.startswith('_')}
+IDENTIFIERS_AFTER = frozenset({"def", "class"})
+KEYWORD_CONSTANTS = frozenset({"True", "False", "None"})
+BUILTINS = frozenset({str(name) for name in dir(builtins) if not 
name.startswith('_')})
 
 
 def THEME(**kwargs):
@@ -226,8 +226,8 @@ def gen_colors_from_token_stream(
                     yield ColorSpan(span, "builtin")
 
 
-keyword_first_sets_match = {"False", "None", "True", "await", "lambda", "not"}
-keyword_first_sets_case = {"False", "None", "True"}
+keyword_first_sets_match = frozenset({"False", "None", "True", "await", 
"lambda", "not"})
+keyword_first_sets_case = frozenset({"False", "None", "True"})
 
 
 def is_soft_keyword_used(*tokens: TI | None) -> bool:

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to