Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Pasting 🏳️‍🌈 crashes the new Python REPL #121609

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixestopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error
@treyhunner

Description

@treyhunner

Crash report

What happened?

To reproduce, start the new Python REPL in 3.13.0b3 and start to assign a string:

$ python3.13Python 3.13.0b3 (main, Jul  2 2024, 13:24:06) [GCC 11.4.0] on linuxType"help","copyright","credits" or"license"for more information.>>> flag ='

Then paste 🏳️‍🌈 and this happens:

$ python3.13Python 3.13.0b3 (main, Jul  2 2024, 13:24:06) [GCC 11.4.0] on linuxType"help","copyright","credits" or"license"for more information.>>> flag ='Traceback (most recent call last):  File "<frozen runpy>", line 198, in _run_module_as_main  File "<frozen runpy>", line 88, in _run_code  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/__main__.py", line 3, in <module>    __pyrepl_interactive_console()    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/main.py", line 55, in interactive_console    run_interactive(namespace)    ~~~~~~~~~~~~~~~^^^^^^^^^^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/simple_interact.py", line 144, in run_multiline_interactive_console    statement = multiline_input(more_lines, ps1, ps2)  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/readline.py", line 385, in multiline_input    return reader.readline()           ~~~~~~~~~~~~~~~^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 768, in readline    self.handle1()    ~~~~~~~~~~~~^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 751, in handle1    self.do_cmd(cmd)    ~~~~~~~~~~~^^^^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 695, in do_cmd    self.refresh()    ~~~~~~~~~~~~^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 672, in refresh    self.screen = self.calc_screen()                  ~~~~~~~~~~~~~~~~^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/completing_reader.py", line 261, in calc_screen    screen = super().calc_screen()  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 360, in calc_screen    l, l2 = disp_str(line)            ~~~~~~~~^^^^^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 61, in disp_str    b.append(str_width(c))             ~~~~~~~~~^^^  File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/utils.py", line 10, in str_width    if ord(c) < 128:       ~~~^^^TypeError: ord() expected a character, but string of length 6 found

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 currentmain 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixestopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp