-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
gh-91102: Port 8-argument _warnings.warn_explicit to Argument Clinic #92891
Conversation
The generated version: - replaces METH_VARARGS with METH_FASTCALL - replaces PyArg_ParseTupleAndKeywords with _PyArg_UnpackKeywords - stresses that warn_explicit() differs object=Py_None and object=NULL
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 |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @erlend-aasland: please review the changes made to this pull request. |
Turning this PR draft until gh-94431 is merged. Without that fix, a proper renaming ( |
AC is now updated with new functionality. Please apply the suggestion in order to restore the parameter name as it was. |
@erlend-aasland Thank you for the fix applied; I renamed the second |
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 the NEWS entry is IMO too verbose. It should be sufficient to say that _warnings.warn_explicit
is ported to AC, and nothing else. I don't think the nitty-gritty details are very interesting for the average user; for core devs, triagers, and other contributors, the benefits are obvious.
Thanks, Oleg and Kumar. |
Benefits:
METH_VARARGS
calling convention is replaced with a little fasterMETH_FASTCALL
(no extra tuple creation)PyArg_ParseTupleAndKeywords
call is replaced with_PyArg_UnpackKeywords
and a tailored parser generated specially for the ported function.warn_explicit()
differentiates situations when itsobject
argument is set toPy_None
andNULL
, while for other optional arguments there is no difference./cc @rhettinger as a person who helped me to learn to classify whether extra abstractions pay off with benefits. This case looks like they do.
Related issue: gh-91102.