Issue 6528: builtins colored as keyword at beginning of line (original) (raw)

Issue6528

Created on 2009-07-20 21:39 by Freiddie, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue6528.patch roger.serwy,2011-12-21 20:48 review
Messages (5)
msg90742 - (view) Author: (Freiddie) Date: 2009-07-20 21:39
I noticed in that whenever I enter "None" at the beginning of the line in IDLE 3.1, the word is colored orange (for keywords) rather than purple. If I insert a space right before the "None", it returns to its normal purple color (for builtins), so it only seems to occur at the beginning of a line. The same thing occurs to "True" and "False", but not "list", "int", etc. This did not occur in 2.6.
msg90750 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-07-21 08:33
In Python 3, True, False and None are keywords, so the orange should be correct. It should be orange also when you do "foo = True" though.
msg150042 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-12-21 20:48
The attached patch excludes keywords from the builtin list and corrects the highlighting configuration panel.
msg151339 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-16 08:23
New changeset 2d4ce2cdd6d4 by Terry Jan Reedy in branch '3.2': #6528 None, True, False are keywords in 3.x. Patch by Roger Serwy. http://hg.python.org/cpython/rev/2d4ce2cdd6d4 New changeset 522f07bfa067 by Terry Jan Reedy in branch 'default': Merge with 3.2 #6528 None, True, False are keywords in 3.x. Patch by R. Serwy. http://hg.python.org/cpython/rev/522f07bfa067
msg151340 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-01-16 08:25
I just realized that there is 'another' reason not to reuse builtin names (other than those usually given): they will be colorized as builtins even if they have no relation to the builtin. Make_pat uses the function any() defined just above (before the builtin, I am sure), so 'any' is colored as if it were the builtin. Within ColorDelegator.py, it is only used within make_pat, so I considered renaming it to anyp or any_pat, but it might be used by some other module that imports ColorDelegator. Another issue. "name not in keyword.kwlist" could be "name not in {None, True, False}", but those happen to be the first three items in the kwlist, so the time difference would be nil. Looks good. Tested on 3.2.2 Win7. Applied.
History
Date User Action Args
2022-04-11 14:56:51 admin set github: 50777
2012-01-16 08:54:29 terry.reedy set assignee: terry.reedy
2012-01-16 08:25:36 terry.reedy set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2012-01-16 08:23:03 python-dev set nosy: + python-devmessages: +
2012-01-16 05:32:11 ezio.melotti set priority: low -> normalnosy: + terry.reedystage: patch review
2011-12-21 20:48:27 roger.serwy set files: + issue6528.patchversions: + Python 3.2, Python 3.3, - Python 3.1nosy: + roger.serwymessages: + keywords: + patch
2009-07-21 08:33:50 ezio.melotti set nosy: + ezio.melottimessages: +
2009-07-20 22:06:27 r.david.murray set priority: lownosy: + gpolo
2009-07-20 21:39:28 Freiddie create