Terry J. Reedy <tjre...@udel.edu> added the comment:

The main use for the iomenu settings is for the socket-transport file classes, 
in run.py.  The default encoding='utf-8' and errors='strict' are not used but 
are overriden with the iomenu values, or for stderr, 'backslashreplace'.

Since user code can print any unicode, I think the defaults should used as is 
to transparently pass on and possibly display anything the user sends.  Such a 
change should have no back-compatibility issues.

Thinking more about errors.  With utf-8 encoding of proper strings, there 
should never be any, but Python does allow construction of 'improper' strings 
with, say, single surrogates.  The transport mechanism should never raise, so 
maybe surrogateescape or backslashreplace should always be used. 

What do you two think?

Another use is for writing bytes to an OutputWindow, as with find-in-files.  
But I can think of no case where IDLE sends bytes to an OutputWindow.  User 
files are all opened in an editor.

I believe these are all the uses of 'iomenu.encoding' outside of iomenu.  'from 
iomenu ...' is never used.

Within iomenu, the only use is part of reading an encoding cookie.
    # The only use of 'encoding' below is in _decode as initial value
    # of deprecated block asking user for encoding.
I am not sure if this use can be reached now.  Even if so, I believe this code 
duplicates code elsewhere in the stdlib that might be used.

So maybe the encoding calculation is not really needed.

----------

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

Reply via email to