Skip to content

BUG: Ignore invalid and overflow warnings in masked setitem#23627

Merged
charris merged 1 commit intonumpy:mainfrom
seberg:issue-23000
Apr 21, 2023
Merged

BUG: Ignore invalid and overflow warnings in masked setitem#23627
charris merged 1 commit intonumpy:mainfrom
seberg:issue-23000

Conversation

@seberg
Copy link
Copy Markdown
Member

@seberg seberg commented Apr 21, 2023

Giving a warning for invalid/overflow in settitem/casts is right (IMO), however for masked arrays it can be surprising since the warning is not useful if the value is invalid but also masked.

So, simply blanket ignore the relevant warnings in setitem via errstate. (There may be some other cases like .astype() where it might be helpful to MA users to just blanket opt-out of these new warnings.)

Closes gh-23000

Giving a warning for invalid/overflow in settitem/casts is right
(IMO), however for masked arrays it can be surprising since the
warning is not useful if the value is invalid but also masked.

So, simply blanket ignore the relevant warnings in setitem via errstate.
(There may be some other cases like `.astype()` where it might be
helpful to MA users to just blanket opt-out of these new warnings.)

Closes numpygh-23000
@seberg seberg added the 09 - Backport-Candidate PRs tagged should be backported label Apr 21, 2023
@seberg seberg added this to the 1.24.3 release milestone Apr 21, 2023
@charris charris merged commit 5fd25ab into numpy:main Apr 21, 2023
@charris
Copy link
Copy Markdown
Member

charris commented Apr 21, 2023

Thanks Sebastian.

@charris charris removed this from the 1.24.3 release milestone Apr 21, 2023
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Apr 21, 2023
@seberg seberg deleted the issue-23000 branch April 22, 2023 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: RuntimeWarning emitted sporadically during __setitem__ on a masked array

2 participants