Skip to content
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

BUG: In numpy.i, clear CARRAY flag if wrapped buffer is not C_CONTIGUOUS. #10557

merged 3 commits into from Feb 9, 2018


None yet
2 participants
Copy link

commented Feb 9, 2018

Backport of #10546.

Without this fix, arrays returned by the ARGOUTVIEW_FARRAY[2,3,4] ARGOUTVIEWM_FARRAY[2,3,4] typemaps have always the flag C_CONTIGUOUS as True even when the underlying buffer is not C contiguous leading to strange runtime behaviors.

Ex: copy() works correctly but binary element wise operations with another C contiguous array does not.

mlamarre added some commits Feb 8, 2018

Swig tool: Clear CARRAY flag when setting FARRAY
Otherwise the returned array has both flags, which creates all sorts of confusing runtime behaviors.
Doesn't cause a crash, but some functions like copy() works in F_CONTIGUOUS others like element wise operators assume C_CONTIGUOUS, obviously this becomes a nightmare to debug.
Swig tool: Clear CARRAY flag when buffer is not C_CONTIGUOUS
Leave the flag if there's only one non unit dim

@charris charris merged commit a0f117d into numpy:maintenance/1.14.x Feb 9, 2018

4 checks passed

ci/circleci Your tests passed on CircleCI!
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
lgtm analysis: Python No alert changes

@charris charris deleted the charris:backport-10546 branch Feb 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.