-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking âSign up for GitHubâ, you agree to our terms of service and privacy statement. Weâll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pasting đłď¸âđ crashes the new Python REPL #121609
Comments
confirmed the reproducer indeed crashes the repl on 3.14 (main branch) on macOS too (with a debug build and GIL disabled, ftr) |
for comparison, this is how it behaves on 3.12:
the |
Hello! The |
I'm working on this :) |
@mgmacias95 It's just a typo, one extra copy-pasted line --- i/Lib/_pyrepl/reader.py
+++ w/Lib/_pyrepl/reader.py
@@ -58,7 +58,6 @@ def disp_str(buffer: str) -> tuple[str, list[int]]:
elif unicodedata.category(c).startswith("C"):
c = r"\u%04x" % ord(c)
s.append(c)
- b.append(str_width(c))
b.extend([0] * (len(c) - 1))
else:
s.append(c) |
If that line is removed the emoji is pasted as:
In prior versions of python it was pasted correctly:
|
It looks like intended behaviour: the code explicitly replaces unprintable control/format/etc characters with their unicode escape sequence. |
âŚer joiner (pythonGH-121667) (cherry picked from commit e745996) Co-authored-by: Marta GĂłmez MacĂas <mgmacias@google.com>
Thank you @treyhunner for the report, @mgmacias95 for the fix, and everyone else for the investigation! |
Crash report
What happened?
To reproduce, start the new Python REPL in 3.13.0b3 and start to assign a string:
Then paste đłď¸âđ and this happens:
This looks like an issue with multiple-character glyphs, as đ´ó §ó ˘ó Ľó Žó §ó ż causes the same issue.
I found myself at my system command prompt after this (Python had exited).
I initially tested this on Python 3.13.0b3, but I also reproduced the issue on the current
main
branch.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.13.0b3 (main, Jul 2 2024, 13:24:06) [GCC 11.4.0]
Linked PRs
The text was updated successfully, but these errors were encountered: