Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-129294: use winapi to determine win version before invoking cmd.exe#129295
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
…before trying to create a process using cmd.exe ver"
ghost commentedJan 25, 2025 • edited by ghost
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by ghost
Uh oh!
There was an error while loading.Please reload this page.
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
@@ -110,7 +110,7 @@ | |||
""" | |||
__version__ = '1.0.9' | |||
__version__ = '1.0.10' |
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.
I don't think this should be updated?
__version__='1.0.10' | |
__version__='1.0.9' |
It was updated a couple of months ago in#122547, but the previous change was 10 years ago (b9f4fea), and there have been lots of updates in the past decade that didn't change it:
https://github.com/python/cpython/commits/main/Lib/platform.py
terryjreedyJan 26, 2025 • edited by hugovk
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by hugovk
Uh oh!
There was an error while loading.Please reload this page.
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.
Is the module__version__
attribute really still needed? I thought that these were obsolete. If kept, is the use defined anywhere in a manner that would say when to bump it?
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.
As I understand it just wasn't kept properly. Each change should increase the version (path, minor, major as needed).
The issue quoted existing code |
I think we should remove this code completely, but if not it will be better to stay just with |
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.
We should avoid usingctypes
here, and use a native function.sys.getwindowsversion
already exists and is already used in this code, and WMI gets the most accurate result and is tried first.
There is no need for this change, but at the very least, it should not usectypes
and should not use kernel mode APIs when user mode ones exist.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
That said, the actual executable that is run could be improved. Explicitly launching |
Hmm, lemme address.
After all I think that:
Thank you ! |
zooba commentedJan 29, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
You should propose a PR that removes the subprocess functionality then. It's already fallback code, so it doesn't need a replacement - we can simply say that if WMI fails, you won't get the version number (or you may get one that reflects the configured compatibility mode, rather than reality). As a policy, we don't use |
Uh oh!
There was an error while loading.Please reload this page.
Improve platform module: use rtlGetVersion to determine win version before trying to use cmd.exe