Skip to content

BUG: Fortify string casts against floating point warnings#22855

Merged
charris merged 1 commit intonumpy:mainfrom
seberg:issue-22843
Dec 21, 2022
Merged

BUG: Fortify string casts against floating point warnings#22855
charris merged 1 commit intonumpy:mainfrom
seberg:issue-22843

Conversation

@seberg
Copy link
Copy Markdown
Member

@seberg seberg commented Dec 21, 2022

This removes the check for floating point warnings, which is enough in practice. (In principle ufuncs or structured dtypes can chain casts in a way that causes us to check anyway.)

It also checks for isfinite in the scalar repr code so the warnings shouldn't be set to begin with.

Closes gh-22843


Edit removed round-tripping check. It is broken for complex longdouble and may sometimes fail for longdouble as well. And thus, I guess should be checked more explicitly and not in the same test.

@seberg seberg added the 09 - Backport-Candidate PRs tagged should be backported label Dec 21, 2022
This removes the check for floating point warnings, which is enough
in practice.  (In principle ufuncs or structured dtypes can chain
casts in a way that causes us to check anyway.)

It also checks for isfinite in the scalar repr code so the warnings
shouldn't be set to begin with.

Closes numpygh-22843
@charris charris merged commit 0478c6f into numpy:main Dec 21, 2022
@charris
Copy link
Copy Markdown
Member

charris commented Dec 21, 2022

Thanks Sebastian.

@seberg seberg deleted the issue-22843 branch December 21, 2022 22:11
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Dec 22, 2022
seberg added a commit to seberg/numpy that referenced this pull request Dec 22, 2022
There is not much value in these values anyway probably, but tiny
isn't reliably for double-double (maybe it should be, but that is
a different issue).

Fixup for numpygh-22855 and numpygh-22868
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: (1.24.0) np.array(np.nan).astype(str) warns RuntimeWarning: invalid value encountered in cast

2 participants