Skip to content
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

Python3.13 is mishandling OSC 633 sequences #126131

Open
anthonykim1 opened this issue Oct 29, 2024 · 1 comment
Open

Python3.13 is mishandling OSC 633 sequences #126131

anthonykim1 opened this issue Oct 29, 2024 · 1 comment
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes stdlib Python modules in the Lib dir topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error

Comments

@anthonykim1
Copy link

anthonykim1 commented Oct 29, 2024

Bug report

Bug description:

Bug Report

Related: #122622

Bug description:

VS Code has set of custom escape sequences that allow shell integration.

We have a custom pythonrc file that we set equal to user's PYTHONSTARTUP file and effectively override user's sys.ps1(this can be improved once we have the pre-exec hook mentioned in the related PR) This allows us to get features that VS Code shell integration offers.

With the new REPL that 3.13 offers, we have noticed that the cursor location is wrongly placed whenever REPL from Python3.13 is launched from our terminal. See:
Screenshot 2024-10-29 at 8 48 48 AM

After investigation we found out it is because Python3.13 is somehow handling our custom sequences such as

command_line="\x1b]633;E;" + str(get_last_command()) + "\x07",

instead of ignoring them as it did in the previous versions of Python. This is what is leads to the wrong cursor location at the end. Removing these sequences brought back the cursor to the "right" position in terminal.

CPython should ignore these custom sequences instead of wrongly handling them.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PR

coming soon (would appreciate advice on where to start digging in but I assume it is somewhere https://github.com/python/cpython/tree/main/Lib/_pyrepl)

@anthonykim1 anthonykim1 added the type-bug An unexpected behavior, bug, or error label Oct 29, 2024
@anthonykim1 anthonykim1 changed the title Python3.13 is wrongly handling OSC 633 sequences Python3.13 is mishandling OSC 633 sequences Oct 29, 2024
@Tyriar
Copy link

Tyriar commented Oct 29, 2024

To clarify, the problem is that any interpreter of escape sequences should be ignoring any OSC sequence it does not understand.

@Eclips4 Eclips4 added 3.13 bugs and security fixes 3.14 new features, bugs and security fixes topic-repl Related to the interactive shell labels Oct 29, 2024
@picnixz picnixz added the stdlib Python modules in the Lib dir label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes stdlib Python modules in the Lib dir topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants