-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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-94808: cover PyFunction_GetDefaults
and PyFunction_SetDefaults
#98449
gh-94808: cover PyFunction_GetDefaults
and PyFunction_SetDefaults
#98449
Conversation
sobolevn
commented
Oct 19, 2022
•
edited by bedevere-bot
Loading
edited by bedevere-bot
- Issue: Metabug: Improving C-level coverage #94808
There's a difference with static PyObject *
func_get_defaults(PyFunctionObject *op, void *Py_UNUSED(ignored))
{
if (PySys_Audit("object.__getattr__", "Os", op, "__defaults__") < 0) {
return NULL;
}
if (op->func_defaults == NULL) {
Py_RETURN_NONE;
}
Py_INCREF(op->func_defaults);
return op->func_defaults;
} |
{ | ||
PyObject *defaults = PyFunction_GetDefaults(func); | ||
if (defaults != NULL) { | ||
Py_INCREF(defaults); |
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.
This is correct because PyFunction_GetDefaults returns a borrowed ref.
Thanks @sobolevn for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
Thanks @sobolevn for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, @sobolevn and @JelleZijlstra, I could not cleanly backport this to |
Sorry @sobolevn and @JelleZijlstra, I had trouble checking out the |
Thanks @sobolevn for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, @sobolevn and @JelleZijlstra, I could not cleanly backport this to |