Skip to content

Programmatically sending indented code to 3.13 REPL causes indentation error #126449

Closed as not planned
@anthonykim1

Description

@anthonykim1

Bug report

Bug description:

Bug Report


Bug Description

Hello, I am working on improving REPL and Terminal experience for people using VS Code Python, and we have been experiencing the indentation issue similar to one you would see in #124096.

I do realize there are indentation error issue mentioned such as one above, but I wasn't sure if it is rooted from same problem since the one in #124096 is Windows, and I am seeing it on MacOS ARM (tested on zsh, xterm.js since we are talking about terminal in VS Code).

From what I've seen, the indentation gets messed up when we programmatically send a indented string into the 3.13 REPL launched from the VS Code Terminal. If I were to send the exact same Python code to 3.13 and to non-3.13(such as 3.9) REPL programmatically, it will lead to two different result:

  • One from Python3.9 (or non-3.13) will be fine, but code sent to 3.13 REPL will suffer from additional indentation as you see below:
Screenshot 2024-11-05 at 8 00 12 AM

What I found surprising during my investigation is that copy-pasting the exact same code, works fine when I manually copy and paste to external Terminal (Both outside of VS Code and also inside VS Code Terminal)

I'm suspecting that there are either:

  1. Magical copy-paste detection mechanism built into 3.13 REPL (such via custom sequences or some environment variable) that VS Code is missing to do.
  2. Something in the new auto-identation that does not accept programmatic send of text to REPL that does not respect pre-idented Python code to be run.

Another issue related to 3.13 REPL in VS Code: #126131

Thanks in advance for your help and care.

/cc @brettcannon @pablogsal @Tyriar

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixestopic-replRelated to the interactive shell

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions