[Python-checkins] cpython (2.7): Issue #21029: IDLE now colors print consistently as a keyword.

raymond.hettinger python-checkins at python.org
Sun Mar 30 06:01:58 CEST 2014


http://hg.python.org/cpython/rev/6f87f50ecab7
changeset:   90035:6f87f50ecab7
branch:      2.7
parent:      90029:3c577e68859e
user:        Raymond Hettinger <python at rcn.com>
date:        Sat Mar 29 21:01:50 2014 -0700
summary:
  Issue #21029: IDLE now colors print consistently as a keyword.

files:
  Lib/idlelib/ColorDelegator.py |  3 +++
  Misc/NEWS                     |  4 ++++
  2 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Lib/idlelib/ColorDelegator.py b/Lib/idlelib/ColorDelegator.py
--- 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
--- 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.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list