-
Notifications
You must be signed in to change notification settings - Fork 35
fix(python): 更新 Python 版本匹配逻辑以支持更广泛的版本 #651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+47
−24
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): 基于路径的反向排序方式可能无法稳定地选出版本最高的 cpython 目录
这个循环依赖对诸如
cpython-3.10.5-*和cpython-3.9.18-*的名称进行字典序反向排序。根据具体命名(例如cpython-3.9.18-*与cpython-3.11.0-*)或未来格式变更,字符串排序可能无法反映真实的版本顺序。如果目标是选择最新的解释器,建议从目录名中提取版本,并按(major, minor, patch)元组排序,而不是按原始字符串排序,以避免在存在多个安装时选到较旧的版本。建议实现方式:
Original comment in English
suggestion (bug_risk): Path-based reverse sorting of cpython dirs may not pick the highest version consistently
This loop relies on reverse lexicographic ordering of names like
cpython-3.10.5-*andcpython-3.9.18-*. Depending on the exact naming (e.g.cpython-3.9.18-*vscpython-3.11.0-*) or future format changes, string ordering may not reflect actual version ordering. If the goal is to pick the newest interpreter, consider extracting the version from the directory name and sorting by a(major, minor, patch)tuple rather than the raw string to avoid selecting an older version when multiple installs exist.Suggested implementation: