You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A multi-byte character in new PyREPL requires two backspaces to delete #142162
Interestingly, there seems two different é
copy this é(\xe9) and it requires single backspace to delete.
copy this é(e\u0301) and it requires two backspaces.
After some searches and tries, I discover the fact that, ́ (\u0301) this is the Combining Acute Accent. It can come after any char, though it may behave very strange when come after non-letter char.
And when it came after a letter like é, it merged automatically. However, it still two chars and apparently need two backspaces to delete (even in github comment area)
However I believe there's something odd in the new REPL as you can see a unexpected space came after é. I can open a new issue about this.
e\u0301 is a string of 2 characters which then becomes a glyph looking like 1 character. But it's still 2 characters, not 1, so we could say that it's also fine (one backspace = one character to delete).
Is there any existing spec we can follow, or we can make a spec to restrict the behavior for CPython?
That's what we call "Combining characters" in the Unicode standard. So we could filter which characters to delete in one go.
Now, the alternative would be to simply check if the character that was removed is a combining character and, if so, continue deleting. I'll try to see if such patch is easy to do or not.
By the way, this doesn't just affect backspace, it also affects navigation. In the old REPL, navigating with arrows skipped combining characters (which is likely readline behavior) while with the new REPL, we need two keystrokes
I'm removing my assignment because (1) I wasn't able to come up with an elegant solution (2) I have other tasks of higher priority. I think a REPL expert should decide what to do here.
Activity
typenoob commentedon Dec 2, 2025
Seems a change with the new colored REPL since 3.13 (#111201)
Extra Info: Node.js REPL also requires two backspaces to delete. Do others think this is problematic?
typenoob commentedon Dec 2, 2025
Interestingly, there seems two different é
copy this é(\xe9) and it requires single backspace to delete.
copy this é(e\u0301) and it requires two backspaces.
yihong0618 commentedon Dec 2, 2025
This is as expected I tried other repl like node and ipython
they are the same behavior.
typenoob commentedon Dec 3, 2025
I also agree it's the right behavior.
After some searches and tries, I discover the fact that, ́ (\u0301) this is the Combining Acute Accent. It can come after any char, though it may behave very strange when come after non-letter char.
And when it came after a letter like é, it merged automatically. However, it still two chars and apparently need two backspaces to delete (even in github comment area)
However I believe there's something odd in the new REPL as you can see a unexpected space came after é. I can open a new issue about this.
grayjk commentedon Dec 3, 2025
@typenoob compare the behavior of the old REPL with the new REPL. The behavior should be the same - one backspace to delete the combined character
grayjk commentedon Dec 3, 2025
@typenoob the space after issue was addressed in #139246 which is fixed in 3.14.1 and 3.15.0a2
typenoob commentedon Dec 3, 2025
In cmd, it's one backspace.
In powershell, it's two backspaces.
In bash, it's one backspace.
It behaves differently among the interactive shells and their versions, some requires two, but some requires one.
Also behaves differently among text edit softwares
We should make a specification for it.
Is there any existing spec we can follow, or we can make a spec to restrict the behavior for CPython?
picnixz commentedon Dec 6, 2025
e\u0301is a string of 2 characters which then becomes a glyph looking like 1 character. But it's still 2 characters, not 1, so we could say that it's also fine (one backspace = one character to delete).That's what we call "Combining characters" in the Unicode standard. So we could filter which characters to delete in one go.
Now, the alternative would be to simply check if the character that was removed is a combining character and, if so, continue deleting. I'll try to see if such patch is easy to do or not.
picnixz commentedon Dec 6, 2025
By the way, this doesn't just affect backspace, it also affects navigation. In the old REPL, navigating with arrows skipped combining characters (which is likely
readlinebehavior) while with the new REPL, we need two keystrokespicnixz commentedon Dec 27, 2025
I'm removing my assignment because (1) I wasn't able to come up with an elegant solution (2) I have other tasks of higher priority. I think a REPL expert should decide what to do here.
cc @pablogsal @ambv