Skip to content

Commit 50fd008

Browse files
committed
Fixes to comparing of Python environments (#23417)
1 parent 268c2eb commit 50fd008

File tree

1 file changed

+9
-3
lines changed
  • src/client/pythonEnvironments/base/info

1 file changed

+9
-3
lines changed

src/client/pythonEnvironments/base/info/env.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,20 @@ export function areSameEnv(
276276
if (leftInfo === undefined || rightInfo === undefined) {
277277
return undefined;
278278
}
279-
const leftFilename = leftInfo.executable!.filename;
280-
const rightFilename = rightInfo.executable!.filename;
281-
279+
if (
280+
(leftInfo.executable?.filename && !rightInfo.executable?.filename) ||
281+
(!leftInfo.executable?.filename && rightInfo.executable?.filename)
282+
) {
283+
return false;
284+
}
282285
if (leftInfo.id && leftInfo.id === rightInfo.id) {
283286
// In case IDs are available, use it.
284287
return true;
285288
}
286289

290+
const leftFilename = leftInfo.executable!.filename;
291+
const rightFilename = rightInfo.executable!.filename;
292+
287293
if (getEnvID(leftFilename, leftInfo.location) === getEnvID(rightFilename, rightInfo.location)) {
288294
// Otherwise use ID function to get the ID. Note ID returned by function may itself change if executable of
289295
// an environment changes, for eg. when conda installs python into the env. So only use it as a fallback if

0 commit comments

Comments
 (0)