Skip to content

Unwanted execution of KeyboardInterrupt . #25468

Closed

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.languageServer setting: 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

Activity

  1. eleanorjboyd commented on Sep 22, 2025

    @eleanorjboyd
    Member

    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).

  2. marciomocellin commented on Sep 22, 2025

    @marciomocellin
    Author

    Unfortunately, it still happens. I verified that the unintended triggering of KeyboardInterrupt started with the pre-release version Python v2025.13.2025080801 (pre-release). The behavior was not present in earlier builds.

    Python v2025.15.2025092201 (pre-release)

    source /home/mocellin/sap-fraude-pedidos/.venv/bin/activate
    mocellin@NOCPU89038:~/sap-fraude-pedidos$ source /home/mocellin/sap-fraude-pedidos/.venv/bin/activate
    (.venv) mocellin@NOCPU89038:~/sap-fraude-pedidos$ /home/mocellin/sap-fraude-pedidos/.venv/bin/python
    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 openai
    >>> 
    

    Python v2025.14.0

    mocellin@NOCPU89038:~/sap-fraude-pedidos$ source /home/mocellin/sap-fraude-pedidos/.venv/bin/activate
    (.venv) mocellin@NOCPU89038:~/sap-fraude-pedidos$ /home/mocellin/sap-fraude-pedidos/.venv/bin/python
    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 openai
    >>> 
    

    Python v2025.13.2025080801 (pre-release)

    mocellin@NOCPU89038:~/sap-fraude-pedidos$ source /home/mocellin/sap-fraude-pedidos/.venv/bin/activate
    (.venv) mocellin@NOCPU89038:~/sap-fraude-pedidos$ /home/mocellin/sap-fraude-pedidos/.venv/bin/python
    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 openai
    >>> 
    

    Python v2025.12.0

    mocellin@NOCPU89038:~/sap-fraude-pedidos$ source /home/mocellin/sap-fraude-pedidos/.venv/bin/activate
    (.venv) mocellin@NOCPU89038:~/sap-fraude-pedidos$ /home/mocellin/sap-fraude-pedidos/.venv/bin/python
    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.
    >>> import openai
    >>> 
    
  3. anthonykim1 commented on Oct 6, 2025

    @anthonykim1

    Márcio Mocellin (@marciomocellin) What happens if you set python.terminal.shellIntegration.enabled to false?

    If that doesnt work, what happens if you set terminal.integrated.shellIntegration.enabled to false?

  4. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Oct 6, 2025
  5. marciomocellin commented on Oct 6, 2025

    @marciomocellin
    Author

    Python v2025.17.2025100201 (pre-release)

    {
    "terminal.integrated.shellIntegration.enabled": true,
    "python.terminal.shellIntegration.enabled": true
    }

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

    {
    "terminal.integrated.shellIntegration.enabled": false,
    "python.terminal.shellIntegration.enabled": true
    }

    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
    >>> import os
    >>> 
    

    {
    "terminal.integrated.shellIntegration.enabled": true,
    "python.terminal.shellIntegration.enabled": false
    }

    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.
    >>> import os
    >>> 
    

    {
    "terminal.integrated.shellIntegration.enabled": false,
    "python.terminal.shellIntegration.enabled": false
    }

    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.
    >>> import os
    >>> 
    
  6. TheCaptainCat commented on Nov 6, 2025

    @TheCaptainCat

    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.ps1 which 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.

  7. 3 remaining items

  8. anthonykim1 commented on Dec 3, 2025

    @anthonykim1

    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.

  9. added
    needs PRReady to be worked on
    and removed
    info-neededIssue requires more information from poster
    on Dec 3, 2025
  10. modified the milestones: , November 2025 on Dec 4, 2025
  11. anthonykim1 commented on Dec 4, 2025

    @anthonykim1

    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:

    1. Open python file.
    2. Execute to REPL in terminal via shift+enter in your python code.
    3. You shouldnt see KeyboardInterrupt again,
  12. marciomocellin commented on Dec 4, 2025

    @marciomocellin
    Author

    Python v2025.19.2025120401 (pre-release)
    Unable to install VS Code Insiders.
    VS Code 1.16.3

    Python 3.12.3 (main, Nov  6 2025, 13:44:16) [GCC 13.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    Ctrl click to launch VS Code Native REPL
    >>> import os
    >>> 
    

    ヾ(⌐■_■)ノ♪

  13. snympi commented on Mar 22, 2026

    @snympi

    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.ps1 which 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.

    Same here. Keyboard interrupt when I run Python code with or without debugging. A immediate rerun attempt is successful without any issues.

  14. LeFanch commented on Mar 29, 2026

    @LeFanch

    Same here, (exactly same as snympi), since 1 to 3 weeks :

    Version: 1.113.0 (system setup)
    Windows 11 pro x64
    Python 3.13.12
    
  15. marciomocellin commented on Mar 30, 2026

    @marciomocellin
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-terminalbugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions