gh-111230: Fix _ssl.c not checking for errors when initializing a module#111232
gh-111230: Fix _ssl.c not checking for errors when initializing a module#111232erlend-aasland merged 6 commits intopython:mainfrom
_ssl.c not checking for errors when initializing a module#111232Conversation
Co-authored-by: Erlend E. Aasland <[email protected]>
serhiy-storchaka
left a comment
There was a problem hiding this comment.
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_CONSTmacro name to make the diff minimal:PyModule_AddIntConstant_ssl.cdoes not handle errors on module creation #111230