Skip to content

Commit fde203e

Browse files
authored
Revert "Fix) Prevent keyboard interrupt for Python3.13 REPL non-Windows " (#24559)
Reverts #24555
1 parent faf37e2 commit fde203e

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

Diff for: src/client/common/terminal/service.ts

+2-12
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
import { traceVerbose } from '../../logging';
2323
import { getConfiguration } from '../vscodeApis/workspaceApis';
2424
import { isWindows } from '../utils/platform';
25-
import { getActiveInterpreter } from '../../repl/replUtils';
2625

2726
@injectable()
2827
export class TerminalService implements ITerminalService, Disposable {
@@ -103,19 +102,10 @@ export class TerminalService implements ITerminalService, Disposable {
103102
});
104103
await promise;
105104
}
105+
106106
const config = getConfiguration('python');
107107
const pythonrcSetting = config.get<boolean>('terminal.shellIntegration.enabled');
108-
109-
let isPython313 = false;
110-
if (this.options && this.options.resource) {
111-
const pythonVersion = await getActiveInterpreter(
112-
this.options.resource,
113-
this.serviceContainer.get<IInterpreterService>(IInterpreterService),
114-
);
115-
pythonVersion?.sysVersion?.startsWith('3.13');
116-
}
117-
118-
if (isPythonShell && (!pythonrcSetting || isWindows() || isPython313)) {
108+
if ((isPythonShell && !pythonrcSetting) || (isPythonShell && isWindows())) {
119109
// If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL.
120110
terminal.sendText(commandLine);
121111
return undefined;

Diff for: src/test/common/terminals/service.unit.test.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import { ITerminalAutoActivation } from '../../../client/terminals/types';
2525
import { createPythonInterpreter } from '../../utils/interpreters';
2626
import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis';
2727
import * as platform from '../../../client/common/utils/platform';
28-
import { IInterpreterService } from '../../../client/interpreter/contracts';
29-
import { PythonEnvironment } from '../../../client/pythonEnvironments/info';
3028

3129
suite('Terminal Service', () => {
3230
let service: TerminalService;
@@ -46,7 +44,6 @@ suite('Terminal Service', () => {
4644
let pythonConfig: TypeMoq.IMock<WorkspaceConfiguration>;
4745
let editorConfig: TypeMoq.IMock<WorkspaceConfiguration>;
4846
let isWindowsStub: sinon.SinonStub;
49-
let interpreterService: TypeMoq.IMock<IInterpreterService>;
5047

5148
setup(() => {
5249
terminal = TypeMoq.Mock.ofType<VSCodeTerminal>();
@@ -90,10 +87,6 @@ suite('Terminal Service', () => {
9087
disposables = [];
9188

9289
mockServiceContainer = TypeMoq.Mock.ofType<IServiceContainer>();
93-
interpreterService = TypeMoq.Mock.ofType<IInterpreterService>();
94-
interpreterService
95-
.setup((i) => i.getActiveInterpreter(TypeMoq.It.isAny()))
96-
.returns(() => Promise.resolve(({ path: 'ps' } as unknown) as PythonEnvironment));
9790

9891
mockServiceContainer.setup((c) => c.get(ITerminalManager)).returns(() => terminalManager.object);
9992
mockServiceContainer.setup((c) => c.get(ITerminalHelper)).returns(() => terminalHelper.object);
@@ -102,8 +95,6 @@ suite('Terminal Service', () => {
10295
mockServiceContainer.setup((c) => c.get(IWorkspaceService)).returns(() => workspaceService.object);
10396
mockServiceContainer.setup((c) => c.get(ITerminalActivator)).returns(() => terminalActivator.object);
10497
mockServiceContainer.setup((c) => c.get(ITerminalAutoActivation)).returns(() => terminalAutoActivator.object);
105-
mockServiceContainer.setup((c) => c.get(IInterpreterService)).returns(() => interpreterService.object);
106-
10798
getConfigurationStub = sinon.stub(workspaceApis, 'getConfiguration');
10899
isWindowsStub = sinon.stub(platform, 'isWindows');
109100
pythonConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
@@ -243,7 +234,7 @@ suite('Terminal Service', () => {
243234
terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.exactly(1));
244235
});
245236

246-
test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux - !Python3.13', async () => {
237+
test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux', async () => {
247238
isWindowsStub.returns(false);
248239
pythonConfig
249240
.setup((p) => p.get('terminal.shellIntegration.enabled'))

0 commit comments

Comments
 (0)