Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BUG: ensure passingnp.dtype to itself doesn't crash#25042

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@ngoldbaum
Copy link
Member

@ngoldbaumngoldbaum commentedOct 31, 2023
edited
Loading

Happy to implement other approaches but adding a check just before the crash happens seemed simplest.

Fixes#25031.

@ngoldbaumngoldbaum added the 09 - Backport-CandidatePRs tagged should be backported labelOct 31, 2023
@ngoldbaumngoldbaumforce-pushed thefix-dtype-autophagia-segfault branch 3 times, most recently from78d0619 toac8f1f1CompareOctober 31, 2023 16:10
@seberg
Copy link
Member

It's a bit funny, I wonder if just flagging it as parametric would actually work :). To some degree, it is well defined (as in, it is identical to the user passing no dtype).
OTOH, in practice it should typically be a user error here. I do wonder if there is an earlier place to reject this nicely...

But, overall, I am also happy with just doing this, I don't think we would have to fret over ever changing it in the future anyway.

@ngoldbaumngoldbaumforce-pushed thefix-dtype-autophagia-segfault branch fromac8f1f1 to0cb5982CompareOctober 31, 2023 17:25
@ngoldbaum
Copy link
MemberAuthor

I wonder if just flagging it as parametric would actually work :)

It turns out this makes the test I added create afloat64 array, which I guess makes sense, there must be a default cast tofloat64 somewhere.

I do wonder if there is an earlier place to reject this nicely...

I ended up moving the check intoPyArray_DTypeOrDescrConverterRequired so the error happens a little earlier.

@seberg
Copy link
Member

Yeah, I think returning float64 there is actually completely fine after all that is whatnp.dtype() gives. Although I am not confident we end up there the right path.

Making this an error for now here seems fine then. If anyone ever feals to relax it to return the float64, I would not be opposed at all, though!

@ngoldbaumngoldbaumforce-pushed thefix-dtype-autophagia-segfault branch from0cb5982 tob046293CompareOctober 31, 2023 17:38
@seberg
Copy link
Member

Thanks Nathan, let's go with this and possibly relax it if we ever find a reason for it.

@sebergseberg merged commit95ca101 intonumpy:mainNov 1, 2023
@charrischarris changed the titleBUG: ensure passingnp.dtype to itself doesn't crashBUG: ensure passingnp.dtype to itself doesn't crashNov 12, 2023
@charrischarris removed the 09 - Backport-CandidatePRs tagged should be backported labelNov 12, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

BUG: segfault when passing dtype module to np.array constructor

3 participants

@ngoldbaum@seberg@charris

[8]ページ先頭

©2009-2025 Movatter.jp