[New-bugs-announce] [issue45904] Pasting the U00FF character into Python REPL misinterprets character

George King report at bugs.python.org
Fri Nov 26 11:28:02 EST 2021


New submission from George King <george.w.king at gmail.com>:

Using macOS 11.6 Terminal.app with Python 3.10.0 installed directly from python.org.

I open the REPL. If I enter `char(0xff)` I get back 'ÿ' as expected (U00FF LATIN SMALL LETTER Y WITH DIAERESIS).

However, If I copy this character with surrounding quotes, and then paste it into the REPL, it pastes as '' and evaluates to the empty string.

If I copy it without quotes and then paste into the REPL, I see nothing. When I hit return, the prompt renders as `>>> ^M>>>`. This suggests that the character is getting misinterpreted as a control character or something.

If I paste it into the terminal shell when the Python REPL is not running, it appears as the latin1 letter that I expect.

If I run `python3 -c 'print("ÿ")'` the character prints fine.

It seems to me that the python REPL is setting some terminal mode that fails on this particular character. Perhaps this is a problem with the macOS readline/libedit implementation?

It seems that only U00FF is problematic; U00FE and U01000 both paste in just fine.

I verified that my terminal profile is set to UTF-8 encoding. I also repeated this experiment in the Kitty terminal emulator, and got identical results.


Here is the readline version:
>>> readline._READLINE_LIBRARY_VERSION
'EditLine wrapper'
>>> readline._READLINE_RUNTIME_VERSION
1026
>>> readline._READLINE_VERSION
1026

----------
messages: 407065
nosy: gwk
priority: normal
severity: normal
status: open
title: Pasting the U00FF character into Python REPL misinterprets character
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45904>
_______________________________________


More information about the New-bugs-announce mailing list