-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
MAINT: Extract a helper function to apply __array_wrap__ #11295
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
8ade643
to
1efd7d7
Compare
goto fail; | ||
} | ||
|
||
Py_DECREF(mps[j]); |
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'm pretty sure that there's a segfault in master for a ufunc with more than one output, where only the second __array_wrap__
fails - this ends up being decref'd both here and in fail.
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.
Yep, fixed in #11296
PyErr_Clear(); | ||
res = PyObject_CallFunctionObjArgs(wrap, mps[j], NULL); | ||
} | ||
Py_DECREF(wrap); |
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.
Memory leak here (and in the new version) - this won't get decref'd for the second output if the first fails.
} | ||
|
||
Py_DECREF(mps[j]); | ||
retobj[i] = res; |
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 memory is also leaked if the second one errors.
Closing - I learnt what I needed to here |
Extracted from #9022, since that's segfaulting, and maybe this piece is fine.