Skip to content

Commit fbd54c2

Browse files
committed
use sendText for inside Python3.13 REPL
1 parent b8cc93d commit fbd54c2

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/client/common/terminal/service.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,22 @@ export class TerminalService implements ITerminalService, Disposable {
102102
});
103103
await promise;
104104
}
105-
105+
// TODO: need to use sendText for Python3.13 as well.
106106
const config = getConfiguration('python');
107107
const pythonrcSetting = config.get<boolean>('terminal.shellIntegration.enabled');
108-
if ((isPythonShell && !pythonrcSetting) || (isPythonShell && isWindows())) {
108+
109+
const pythonPath = this.serviceContainer
110+
.get<IConfigurationService>(IConfigurationService)
111+
.getSettings(this.options?.resource).pythonPath;
112+
const interpreterInfo =
113+
this.options?.interpreter ||
114+
(await this.serviceContainer
115+
.get<IInterpreterService>(IInterpreterService)
116+
.getInterpreterDetails(pythonPath));
117+
const pythonVersion = interpreterInfo && interpreterInfo.version ? interpreterInfo.version.raw : undefined;
118+
const isPython313 = pythonVersion?.startsWith('3.13');
119+
120+
if (isPythonShell && (!pythonrcSetting || isWindows() || isWsl() || isPython313)) {
109121
// If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL.
110122
terminal.sendText(commandLine);
111123
return undefined;

0 commit comments

Comments
 (0)