Skip to content

Pybind11 contiguous check: Accept only C-contiguous, not Fortran contiguous#1886

Merged
franzpoeschel merged 1 commit into
openPMD:devfrom
franzpoeschel:fix-contiguous-check
Jun 8, 2026
Merged

Pybind11 contiguous check: Accept only C-contiguous, not Fortran contiguous#1886
franzpoeschel merged 1 commit into
openPMD:devfrom
franzpoeschel:fix-contiguous-check

Conversation

@franzpoeschel

Copy link
Copy Markdown
Contributor

Checking for 'A' means success if the buffer is contiguous in either C or Fortran. The Python bindings are not the right place to accept Fortran-style arrays; in any case it would be the job of eventual Fortran bindings to find a solution for storing those correctly. At this point, we can accept only C-style arrays.

Unintended consequence: Our bindings currently do not catch the noncontiguous buffer view created by transposing an array:
Close #1882

@franzpoeschel franzpoeschel added this to the 0.17.1 milestone Jun 8, 2026
@franzpoeschel franzpoeschel requested a review from ax3l June 8, 2026 10:07
@franzpoeschel franzpoeschel changed the title Fix Pybind contiguous check: Accept only C-contiguous, not Fortran contiguous Pybind11 contiguous check: Accept only C-contiguous, not Fortran contiguous Jun 8, 2026
@franzpoeschel franzpoeschel merged commit b025a5d into openPMD:dev Jun 8, 2026
31 checks passed
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this pull request Jun 9, 2026
@ax3l ax3l self-assigned this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transposed numpy array is written incorrectly

2 participants