Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

eric-wieser
Copy link
Member

Extracted from #9022, since that's segfaulting, and maybe this piece is fine.

goto fail;
}

Py_DECREF(mps[j]);
Copy link
Member Author

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.

Copy link
Member Author

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);
Copy link
Member Author

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;
Copy link
Member Author

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.

@eric-wieser
Copy link
Member Author

Closing - I learnt what I needed to here

@eric-wieser eric-wieser deleted the array-wrap-helper branch June 11, 2018 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant