Issue #21029: IDLE now colors print consistently as a keyword.
diff --git a/Lib/idlelib/ColorDelegator.py b/Lib/idlelib/ColorDelegator.py
index c74865d..4838c44 100644
--- a/Lib/idlelib/ColorDelegator.py
+++ b/Lib/idlelib/ColorDelegator.py
@@ -16,6 +16,9 @@
kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b"
builtinlist = [str(name) for name in dir(__builtin__)
if not name.startswith('_')]
+ # We don't know whether "print" is a function or a keyword,
+ # so we always treat is as a keyword (the most common case).
+ builtinlist.remove('print')
# self.file = file("file") :
# 1st 'file' colorized normal, 2nd as builtin, 3rd as string
builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
diff --git a/Misc/NEWS b/Misc/NEWS
index d08d0c1..49dbe53 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -265,6 +265,10 @@
- Issue #20406: Use Python application icons for Idle window title bars.
Patch mostly by Serhiy Storchaka.
+- Issue #21029: Occurrences of "print" are now consistently colored as
+ being a keyword (the colorizer doesn't know if print functions are
+ enabled in the source).
+
- Issue #17721: Remove non-functional configuration dialog help button until we
make it actually gives some help when clicked. Patch by Guilherme Simões.