STINNER Victor victor.stin...@haypocalc.com added the comment:
I created a new issue for Ezio's proposition to patch sys.displayhook: issue
#10601.
To answer the initial question, Should repr() print unicode characters outside
the BMP?, Marc-Andre, Ezio and me agree that we should keep the
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9198
___
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +belopolsky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9198
___
___
Python-bugs-list
STINNER Victor victor.stin...@haypocalc.com added the comment:
About issue9198.diff:
- exit directly if !PyErr_ExceptionMatches(PyExc_UnicodeEncodeError) to avoid
an useless level of indentation
- why do you clear the exception before calling PyObject_Repr()? if you cannot
execute code while
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +merwok
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9198
___
___
Python-bugs-list mailing
Ezio Melotti ezio.melo...@gmail.com added the comment:
Assigning to myself so that I'll remember to finish and commit the patch.
--
assignee: - ezio.melotti
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9198
Ezio Melotti ezio.melo...@gmail.com added the comment:
Here is a patch to fix sys_displayhook (note: the patch is just a proof of
concept -- it seems to work fine but I still have to clean it up, add comments,
rename and reorganize some vars and add tests).
This is an example output while
New submission from Amaury Forgeot d'Arc amaur...@gmail.com:
On wide unicode builds, '\U0001'.isprintable() returns True, and repr()
returns the character unmodified.
Is it a good behavior, given that very few fonts have can display this
character?
Marc-Andre Lemburg wrote:
The printable
Marc-Andre Lemburg m...@egenix.com added the comment:
[Adding some bits from the discussion on #5127 for better context]
Ezio Melotti wrote:
Ezio Melotti ezio.melo...@gmail.com added the comment:
[This should probably be discussed on python-dev or in another issue, so
feel free to
Ezio Melotti ezio.melo...@gmail.com added the comment:
Regarding the fonts, I think that who actually uses or needs to use characters
outside the BMP might have (now or in a few months/years) a font able to
display them.
I also tried to print the printable chars from U+ to U+1 on my
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
A more accurate approach would be to actually try to encode the string
and escape only the chars that can't be encoded
This is already the case with sys.stderr, it uses the backslashreplace error
handler. Do you suggest the same for
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
Yes, repr() should not depend on the user's terminal.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9198
___
Ezio Melotti ezio.melo...@gmail.com added the comment:
This is already the case with sys.stderr, it uses the backslashreplace
error handler. Do you suggest the same for sys.stdout?
See http://bugs.python.org/issue5110#msg84965
--
___
Python
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
The chapter Rationale in PEP3138 explains why sys.stdout uses strict
encoding, when sys.stderr uses backslashreplace.
It would be possible to use backslashreplace for stdout as well for
interactive sessions, but the PEP also rejected
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9198
___
___
Ezio Melotti ezio.melo...@gmail.com added the comment:
Yes, but as I said in the message I linked, that's *not* what I want to do.
I want to change only the behavior of the interactive interpreter and only when
the string sent to stdout is not encodable (so only when the encoding is not
Martin v. Löwis mar...@v.loewis.de added the comment:
I think if you change it stop considering non-BMP characters as printable,
somebody will complain. If you change it in any other way, somebody will
complain. Somebody will always complain - so you might as well leave things the
way they
STINNER Victor victor.stin...@haypocalc.com added the comment:
amaury Should repr() print unicode characters outside the BMP?
Yes. I don't understand why characters outside the BMP will be considered
differently than other characters. Is it a workaround for bogus operating
systems? My Linux
Ezio Melotti ezio.melo...@gmail.com added the comment:
I suggest to:
1) keep the current behavior for non-BMP chars (i.e. print them normally);
2) change isprintable to consider the Zx categories printable (this will
affect repr() too);
3) change displayhook (*NOT* sys.stdout.encoding) to
Changes by Adam Olsen rha...@gmail.com:
--
nosy: +Rhamphoryncus
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9198
___
___
Python-bugs-list
20 matches
Mail list logo