-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-111230: Fix _ssl.c
not checking for errors when initializing a module
#111232
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
Conversation
Co-authored-by: Erlend E. Aasland <[email protected]>
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.
LGTM, but I would prefer to not use ALL_CAPS for macro parameters (here, and in your other PRs). It is very unusual (and perhaps against PEP 7). Please only use ALL_CAPS for macro names.
@serhiy-storchaka I think that this is the style suggested and prefered by @erlend-aasland, I am ok with both. |
There is no mention of macro arguments in PEP-7; please do not spread uncertainty and doubt like this. I personally prefer ALL_CAPS macro parameters since it makes them stand out better from implicit variables that are not part of the macro "scope"; for example, many macros are used in extension module initialisation phase, and very often, the module object is implicitly used from within the macro. Using ALL_CAPS macro parameters makes it clear that these parameters are text strings (and not variables) that will be replaced by the pre-processor. Also, note that this style is used other places in the code base by other core devs. |
Thanks @sobolevn for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Thanks @sobolevn for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, @sobolevn and @erlend-aasland, I could not cleanly backport this to
|
Sorry, @sobolevn and @erlend-aasland, I could not cleanly backport this to
|
|
Indeed, PEP 7 does not specify it explicitly. But all examples in PEP 7 and AFAIK all existing macros write parameter names in lower case. If some macros write it in upper case, it perhaps a new tendency, I never seen this before. I think that it should be specified in PEP 7 explicitly. |
I created a new discussion for this: https://discuss.python.org/t/all-caps-for-macro-parameter-names/37119. |
I agree.
Thanks! |
@sobolevn @erlend-aasland Does this still need backporting? If not, let's close #111230. |
Introduce ADD_INT_CONST macro wrapper for PyModule_AddIntConstant()
Introduce ADD_INT_CONST macro wrapper for PyModule_AddIntConstant()
I've used
_PyModule_ADD_INT_CONST
macro name to make the diff minimal:PyModule_AddIntConstant
_ssl.c
does not handle errors on module creation #111230