]> granicus.if.org Git - python/commitdiff
Issue #21029: IDLE now colors print consistently as a keyword.
authorRaymond Hettinger <python@rcn.com>
Sun, 30 Mar 2014 04:01:50 +0000 (21:01 -0700)
committerRaymond Hettinger <python@rcn.com>
Sun, 30 Mar 2014 04:01:50 +0000 (21:01 -0700)
Lib/idlelib/ColorDelegator.py
Misc/NEWS

index c74865d4fb43719f55ec9a515860e485fd9e10e7..4838c44c8cf58af6c699fff6135558d32f105961 100644 (file)
@@ -16,6 +16,9 @@ def make_pat():
     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"
index d08d0c1d6a01006f817d6086b641e3b34e8d13d9..49dbe53e13e094ccb67a78fc7ad2ae23900ef86a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -265,6 +265,10 @@ IDLE
 - 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.