Terry J. Reedy added the comment:

One of the problem with encoding recognition is that the same logic is 
more-or-less reproduced multiple places, so any fix needs to be applied 
multiple places. From the detect_encoding_in_comments_only.patch:
Lib/idlelib/IOBinding.py
Lib/lib2to3/pgen2/tokenize.py
Lib/tokenize.py
Tools/scripts/findnocoding.py
Any fix for issues *18960 and *18961 may also need multiple applications.

If there is not now, it would be nice if there were just one python-coded 
function in Lib/tokenize.py that could be imported and used by the other python 
code. (I was going to suggest exposing the function in tokenize.c, but I 
believe the point of tokenize.py is to not be dependent on CPython.)

I believe the Idle support for \r became obsolete when support for MacOS9 was 
dropped in 2.4. I notice that it is not part of io universal newline support.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18873>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to