Repository navigation
Unwanted execution of KeyboardInterrupt . #25468
Copy link
Copy link
Closed
Labels
area-terminalbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugverifiedVerification succeededVerification succeeded
Milestone
Description
Type: Bug
Behaviour
I updated the extension to Python v2025.14.0. When I run shift+enter, KeyboardInterrupt appears in the terminal. When I return to the previous version, this does not happen.
Steps to reproduce:
Python 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>>
KeyboardInterrupt
>>> import asyncio
umber: int):
print(
"Eu sou um pinguim falante superespecial. Muito mais legal que aquela impressora. "
f"Aliás, meu número da sorte é: {magic_number}."
)
>>> async def loudmouth_penguin(magic_number: int):
... print(
... "Eu sou um pinguim falante superespecial. Muito mais legal que aquela impressora. "
... f"Aliás, meu número da sorte é: {magic_number}."
... )
...
>>>
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
XXX
Extension version: 2025.14.0
VS Code version: Code 1.104.1 (0f0d87fa9e96c856c5212fc86db137ac0d783365, 2025-09-17T23:36:24.973Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
- Python version (& distribution if applicable, e.g. Anaconda): 3.12.3
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServersetting: Default
User Settings
languageServer: "Pylance"
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| copilot | Git | 1.372.0 |
| copilot-chat | Git | 0.31.0 |
| debugpy | ms- | 2025.10.0 |
| js-debug | ms- | 1.104.0 |
| python | ms- | 2025.14.0 |
| vscode-js-profile-table | ms- | 1.0.10 |
| vscode-language-pack-pt-BR | MS- | 1.104.2025091009 |
| vscode-pylance | ms- | 2025.8.1 |
| vscode-python-envs | ms- | 1.8.0 |
System Info
| Item | Value |
|---|---|
| CPUs | 12th Gen Intel(R) Core(TM) i5-1245U (12 x 2496) |
| GPU Status | 2d_canvas: enabled direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off trees_in_viz: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 15.64GB (2.25GB free) |
| Process Argv | --crash-reporter-id a70fe56d-14c0-43e9-97b4-2c2fe54536b3 |
| Screen Reader | no |
| VM | 0% |
| Item | Value |
|---|---|
| Remote | WSL: Ubuntu |
| OS | Linux x64 6.6.87.2-microsoft-standard-WSL2 |
| CPUs | 12th Gen Intel(R) Core(TM) i5-1245U (12 x 0) |
| Memory (System) | 7.58GB (5.46GB free) |
| VM | 0% |
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
aj953862:31281341
nesew2to5:31336538
agentgpt4:31387437
4f60g487:31327383
nes-set-on:31351930
63221493:31336333
0927b901:31350571
ovs_c:31383294
0cj2b977:31352657
cloudbuttont:31379625
todos-1:31384886
control_gpt5applypatchexclusively:31387916
42190218_ostrepl:31382710
metis-embeddings:31387854
trigger-command-fix:31379601
auto_model_enabled:31385282
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-terminalbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugverifiedVerification succeededVerification succeeded
Activity
eleanorjboyd commentedon Sep 22, 2025
Hi! Can you update to the newest version for the python environments extension and try it again? I think I merged in a code change that should help with this. If not, please return the command you are trying to execute, and what happens when you do so from the terminal (as we look to replicate that experience).
marciomocellin commentedon Sep 22, 2025
Unfortunately, it still happens. I verified that the unintended triggering of
KeyboardInterruptstarted with the pre-release versionPython v2025.13.2025080801 (pre-release). The behavior was not present in earlier builds.Python v2025.15.2025092201 (pre-release)
Python v2025.14.0
Python v2025.13.2025080801 (pre-release)
Python v2025.12.0
anthonykim1 commentedon Oct 6, 2025
Márcio Mocellin (@marciomocellin) What happens if you set
python.terminal.shellIntegration.enabledto false?If that doesnt work, what happens if you set terminal.integrated.shellIntegration.enabled to false?
marciomocellin commentedon Oct 6, 2025
Python v2025.17.2025100201 (pre-release)
{
"terminal.integrated.shellIntegration.enabled": true,
"python.terminal.shellIntegration.enabled": true
}
{
"terminal.integrated.shellIntegration.enabled": false,
"python.terminal.shellIntegration.enabled": true
}
{
"terminal.integrated.shellIntegration.enabled": true,
"python.terminal.shellIntegration.enabled": false
}
{
"terminal.integrated.shellIntegration.enabled": false,
"python.terminal.shellIntegration.enabled": false
}
TheCaptainCat commentedon Nov 6, 2025
I have the same problem, with a keyboard interrupt in the REPL (with
shift+enter).It also happens in a regular terminal. I'm mid-command, and I get interrupted by the command
^C; & C:\...\.venv\Scripts\Activate.ps1which takes a few seconds to come.The worst is that it kills the debugger the first time the debug terminal opens.
I have to launch it again every time this terminal is closed.
3 remaining items
anthonykim1 commentedon Dec 3, 2025
I suspect this is better (at least for executing via shift+enter) with https://code.visualstudio.com/updates/v1_106#_consolidated-shell-integration-timeout-setting but it may not be enough.
I think we need a better fix. I will look into this and share any updates here, thanks all.
Fix KeyboardInterrupt in REPL (microsoft#25625)
anthonykim1 commentedon Dec 4, 2025
I believe this should be fixed with #25625
Please give it a try on the latest VS Code Insiders:
Insiders build?
And using Python extension PRE-Release version.
Steps to repro:
marciomocellin commentedon Dec 4, 2025
Python v2025.19.2025120401 (pre-release)
Unable to install VS Code Insiders.
VS Code 1.16.3
ヾ(⌐■_■)ノ♪
snympi commentedon Mar 22, 2026
Same here. Keyboard interrupt when I run Python code with or without debugging. A immediate rerun attempt is successful without any issues.
LeFanch commentedon Mar 29, 2026
Same here, (exactly same as snympi), since 1 to 3 weeks :
marciomocellin commentedon Mar 30, 2026
Fañch (@LeFanch) and Pieter Snyman (@snympi)
I open a new issue: #25885
You need to call Eleanor Boyd (@eleanorjboyd)