forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.Covers everything internal: CI, testing, refactoring of the codebase, etc.verifiedVerification succeededVerification succeeded
Milestone
Description
This check is done to ensure if entered interpreter path is valid, and if so, the path is returned. I don't see the point of these checks, as we shouldn't support entering interpreter paths this way.
Variable 'pythonPath' refers to the path user entered
vscode-python/src/client/common/configSettings.ts
Lines 674 to 696 in 620b614
| const KnownPythonExecutables = ['python', 'python4', 'python3.6', 'python3.5', 'python3', 'python2.7', 'python2']; | |
| for (let executableName of KnownPythonExecutables) { | |
| // Suffix with 'python' for linux and 'osx', and 'python.exe' for 'windows'. | |
| if (IS_WINDOWS) { | |
| executableName = `${executableName}.exe`; | |
| if (isValidPythonPath(path.join(pythonPath, executableName))) { | |
| return path.join(pythonPath, executableName); | |
| } | |
| if (isValidPythonPath(path.join(pythonPath, 'scripts', executableName))) { | |
| return path.join(pythonPath, 'scripts', executableName); | |
| } | |
| } else { | |
| if (isValidPythonPath(path.join(pythonPath, executableName))) { | |
| return path.join(pythonPath, executableName); | |
| } | |
| if (isValidPythonPath(path.join(pythonPath, 'bin', executableName))) { | |
| return path.join(pythonPath, 'bin', executableName); | |
| } | |
| } | |
| } | |
| return pythonPath; |
Also, the first check when ensuring if interpreter path is valid is we should be checking if the entered path exists, which we're not doing.
This leads to us launching 14 exec commands <python> -c '1234' everytime a user enters an invalid path - leading to extension consuming too much CPU.
Metadata
Metadata
Assignees
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.Covers everything internal: CI, testing, refactoring of the codebase, etc.verifiedVerification succeededVerification succeeded