Skip to content

Stop py::array_t arguments from accepting arrays that do not match the C- or F-contiguity flags #2484

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 15, 2020

Conversation

YannickJadoul
Copy link
Collaborator

noconvert checks for py::array_t whether the passed type is compatible, but it doesn't check whether the array::c_style or array::f_style flags are satisifed. See #2455 for a demonstration.

Closes #2455

Copy link
Collaborator

@henryiii henryiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me. I like the new test. 👍

@YannickJadoul
Copy link
Collaborator Author

Looks great to me. I like the new test. 👍

Thanks! I despise the size/complexity of the test, myself 😄 But at least we know it should be quite safe to merge.

I'll wait a bit longer if anyone else has something to say, and if we get no further complaints, I'll merge :-)

@wjakob
Copy link
Member

wjakob commented Sep 15, 2020

I vaguely remember running into this annoying issue myself. Fix and test look all good to me.

@YannickJadoul YannickJadoul merged commit 9df1383 into pybind:master Sep 15, 2020
@YannickJadoul
Copy link
Collaborator Author

Thanks! :-)

@YannickJadoul YannickJadoul deleted the numpy-check-contiguity branch September 15, 2020 12:51
@aldanor
Copy link
Member

aldanor commented Sep 17, 2020

That's nice! Worth releasing 2.6.0 with this feature perhaps? (it's been a while since 2.5.0 anyway)

@henryiii
Copy link
Collaborator

There are quite a few things in 2.6.0 :) I think we need a bit more time to make sure the latest changes (especially the setup.py rework) are nice and stable and useful before we release. I don't think it's too far away, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[QUESTION] Enforce array_t type and ordering
5 participants