Skip to content

Conversation

@eric-wieser
Copy link
Member

An alternative to #10470, which ensure that output arguments are never passed to __array_wrap__ or __array_prepare__ in context[1].

Done as an additional commit for ease of comparison with #10470, but can be squashed.

Fixes numpygh-10450.

The previous behavior for `ufunc(..., out=arr)` is now applied to all calling conventions for `out` - namely, the arg tuple passed into `__array_wrap__` and `__array_prepare__` is `(in1, ..., inN, out1, ..., outN)`. This tuple will contain `None` for absent `out` argument, which is consistent with what already happened for `ufunc(..., out=None)`.

This breaks one test that asserts the length of the args tuple is `2` for np.minimum(x, y).
However, I'd argue that test was broken anyway, and it has been expanded to cover all cases.
@eric-wieser eric-wieser requested a review from mhvk January 29, 2018 08:36
@eric-wieser eric-wieser changed the title array wrap no outputs BUG: Never pass output arguments to __array_wrap__ or __array_prepare__ Jan 29, 2018
@eric-wieser eric-wieser force-pushed the __array_wrap__-no-outputs branch from a283ab2 to 20da6ed Compare January 30, 2018 05:04
@eric-wieser
Copy link
Member Author

Segfault fixed, hopefully. A little messy unfortunately, but should be fairly straightforward to push upstream to the argument parsing once this is in.

@eric-wieser
Copy link
Member Author

#10919 replaces this PR

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