Unexpected indent when using "Run selection in terminal"

I’m getting this error when I try to use the “Run Selection/Line in Python Terminal” feature. I.e. when I run code with indents (if statements, functions) the selection is indented incorrectly in the terminal. Copy+paste works fine.

The error looks exactly the same as the video in the vscode github issue.

I do not get this error in vscode itself (as far as I can tell I have the same settings).

Ok I changed to from Python3.13 to Python3.12 and that fixed it.

Seems to be a 3.13 thing that’s now fixed in VSCode:

VSCode Issue: Python3.13 All functions fail to send: IndentationError: unexpected indent · Issue #24256 · microsoft/vscode-python · GitHub

VSCode PR that fixes it: add bracketed paste mode for Python3.13 and above by anthonykim1 · Pull Request #24401 · microsoft/vscode-python · GitHub

It seems this issue can be resolved by using the latest version of Python extensions when using Python 3.13. Currently in Cursor, we can only use outdated versions (at least 6 months old) of Python, Pylance, and Python debugger. Because of this, various bugs and security issues are being reported. I hope the Cursor team resolves this problem soon.