Skip to content

BUG: avoid warning on ufunc with where=True and no output#31045

Merged
mattip merged 1 commit into
numpy:mainfrom
mhvk:ufunc_no_warn_on_where_is_true_without_out
Mar 22, 2026
Merged

BUG: avoid warning on ufunc with where=True and no output#31045
mattip merged 1 commit into
numpy:mainfrom
mhvk:ufunc_no_warn_on_where_is_true_without_out

Conversation

@mhvk

@mhvk mhvk commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Alternative fix for gh-31030. This does not change that out=None is removed from what is passed to the ufunc, but ensures that if from the ufunc one calls the original function with the original keyword arguments, there will only be a warning about a missing out argument if where!=True. Hence, the net effect is that the warning introduced in gh-29813 will no longer fire if there is no risk of uninitialized output.

(No AI was used.)

Alternative fix for numpygh-31030. This does not change that `out=None` is
removed from what is passed to the ufunc, but ensures that if from the
ufunc one calls the original function with the original keyword
arguments, there will only be a warning about a missing `out` argument
if `where!=True`.
@mhvk mhvk force-pushed the ufunc_no_warn_on_where_is_true_without_out branch from c35b6bc to 41afc3b Compare March 22, 2026 14:17
@mattip

mattip commented Mar 22, 2026

Copy link
Copy Markdown
Member

Makes sense, but it does not solve the problem around __arrray_ufunc__ argument passing.

@mattip mattip merged commit 6de80d1 into numpy:main Mar 22, 2026
79 checks passed
@mattip

mattip commented Mar 22, 2026

Copy link
Copy Markdown
Member

Thanks @mhvk

@mhvk mhvk deleted the ufunc_no_warn_on_where_is_true_without_out branch March 22, 2026 16:34
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Mar 23, 2026
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.

3 participants