-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Nonexisting encoding specified in Tix.py #73109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
$ head 'c:\Py\Lib\lib-tk\Tix.py' -n 1
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- There's no "iso-latin-1-unix" encoding in Python, so this declaration produces an error in some code analysis tools (I have it in PyScripter), as it should according to PEP-263 . In 3.x, this was fixed in changeset d63344ba187888b6792ba8362a0dd09e06ed2f9a . |
I am a little puzzled as to how a file rename changed the content, but the annotation history seems to show that. Anyway, ... When I load the file in IDLE 2.7, I get a warning. I am a bit surprised as this is not a proper encoding declaration. IDLE's re must be a bit loose. In 3.x, the file starts with # --mode: python; fill-column: 75; tab-width: 8 -- # This is all ancient, obsolete, junk specific to some editor. (The file itself not used 4 space indents.) I think it should be removed from all current versions. As near as I can tell, there are no non-ascii chars in the file. |
I'm more puzzled how noone has noticed this until now if it's supposed to produce an error upon compilation. (Well, it doesn't. I couldn't quite figure out how the encoding declaration is parsed, but it's clear the line _isn't_ matched as a regex like the docs say.) |
I reread I also did some experiments. Apparently, "iso-latin-1-unix" is recognized by Python. On Windows, from an IDLE editor, Since codecs.lookup() returns the same error for both lines: Note that 'recognized as a legitimate encoding name' and 'available on a particular installation' are different concepts. I believe codecs.lookup implements the latter. |
Serhiy, if you agree with the proposed removal, but want me to do it, I will. |
Yes, CPython tokenizer recognizes encoding starting with "iso-latin-1-" as "iso-8859-1" (see get_normal_name() in Parser/tokenizer.c:228). I agreed that coding cookie or all line can be removed from Tix.py. Please do that. |
New changeset ef03aff3b195 by Terry Jan Reedy in branch '2.7': |
New changeset eb8667196f93 by Terry Jan Reedy in branch '3.5': New changeset 4a82412a3c51 by Terry Jan Reedy in branch '3.6': New changeset 41031fdc924a by Terry Jan Reedy in branch 'default': |
Misc/NEWS
so that it is managed by towncrier #552Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: