-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-95461: Add some parameters in CreateKeyEx and OpenKeyEx in winreg #129903
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
base: main
Are you sure you want to change the base?
Conversation
zooba
left a comment
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.
Looks good, and I'd appreciate having the extra option there! Just need those audit events reverted - I don't think we need new ones.
|
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 |
zooba
left a comment
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.
Nearly there! Most important thing now I think is updating the real docs in Doc\library\winreg.rst.
| An integer that specifies an access mask that describes the desired | ||
| security access for the key. Default is KEY_READ. | ||
| options: int = 0 | ||
| Can be one of the REG_OPTION_* constants. |
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 probably document the interaction with reserved here. I'm not sure what the history is of reserved becoming a meaningful parameter, but it's meaningful now, so we should say that here (and in the real docs, Doc\library\winreg.rst). (I mean "here" as in a few lines above, but I can't comment on it because it hasn't been updated yet).
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 could make all optional parameters keyword-only. If there are many optional parameters, passing positional arguments is error-prone.
Also, imagine the code that calls CreateKeyEx(key, sub_key, options, access) was executed in the old Python version. It will silently ignore the third argument.
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.
Hi, I updated and changed the newly added reversed to keyword-only. Change all the optional parameters to keyword-only should be in another PR I think?
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
|
Hi, I just noticed that currently |
|
Hmm... perhaps we would be better to look at this as a stepping stone to replacing the
And keep |
Doc/library/winreg.rst
Outdated
|
|
||
|
|
||
| .. function:: CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE) | ||
| .. function:: CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE, options=0, create_only=False) |
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 think it is worth to make all new parameters keyword-only. Their order differs from the order in RegCreateKeyExW(), so passing them as positional arguments will be errorprone.
We can also deprecate passing reserved (which should not be here at first place) and access by keyword, but this is a different issue.
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.
Hi, thank you for the review. I made the newly added parameters options and create_only keyword-only-ed.
| An integer that specifies an access mask that describes the desired | ||
| security access for the key. Default is KEY_READ. | ||
| options: int = 0 | ||
| Can be one of the REG_OPTION_* constants. |
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 could make all optional parameters keyword-only. If there are many optional parameters, passing positional arguments is error-prone.
Also, imagine the code that calls CreateKeyEx(key, sub_key, options, access) was executed in the old Python version. It will silently ignore the third argument.
Uh oh!
There was an error while loading. Please reload this page.