[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal raises an error (Py3)

Ezio Melotti report at bugs.python.org
Wed Apr 1 04:42:04 CEST 2009


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

In the first message I said that this breaks the PEP3138 because I
thought that the solution was to change the default error-handler to
'backslashreplace', but this was already proposed and refused.

sys.displayhook provides a way to change the behavior of the interactive
interpreter only when ">>> foo" is used. The PEP doesn't seem to say
anything about how ">>> foo" should behave.

Moreover, in the alternate solutions [1] they considered to use
sys.displayhook (and sys.excepthook) but they didn't because "these
hooks are called only when printing the result of evaluating an
expression entered in an interactive Python session, and doesn't work
for the print() function, for non-interactive sessions or for
logging.debug("%r", ...), etc."

This is exactly the behavior I intended to have, and, being a unique
feature of the interactive interpreter, it doesn't lead to inconsistence
with other situations.

[1]: http://www.python.org/dev/peps/pep-3138/#alternate-solutions

----------
nosy: +atsuoi

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5110>
_______________________________________


More information about the Python-bugs-list mailing list