Skip to content

Fix of #4237 : 'ValueError: Input array must be contiguous' when *cas… - #4238

Open
raphaeljolivet wants to merge 4 commits into
zarr-developers:mainfrom
raphaeljolivet:bugfix/4237-cast-value-transpose-input-aray-should-be-contiguous
Open

Fix of #4237 : 'ValueError: Input array must be contiguous' when *cas…#4238
raphaeljolivet wants to merge 4 commits into
zarr-developers:mainfrom
raphaeljolivet:bugfix/4237-cast-value-transpose-input-aray-should-be-contiguous

Conversation

@raphaeljolivet

@raphaeljolivet raphaeljolivet commented Aug 5, 2026

Copy link
Copy Markdown

Fix of #4237 with unit test.

@github-actions github-actions Bot added the needs release notes Automatically applied to PRs which haven't added release notes label Aug 5, 2026
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.99%. Comparing base (4e13cf5) to head (1b90d55).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4238   +/-   ##
=======================================
  Coverage   93.99%   93.99%           
=======================================
  Files          91       91           
  Lines       12792    12792           
=======================================
  Hits        12024    12024           
  Misses        768      768           
Files with missing lines Coverage Δ
src/zarr/codecs/cast_value.py 98.60% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Use np.ascontiguousarray before calling cast-value-rs, and add regression
tests for cast_value + transpose filter orderings.
Fixes zarr-developers#4237
@raphaeljolivet
raphaeljolivet force-pushed the bugfix/4237-cast-value-transpose-input-aray-should-be-contiguous branch from 212fd4a to f8564b1 Compare August 5, 2026 11:06
arr = chunk_array.as_ndarray_like()
target_native = self.dtype.to_native_dtype()

result = self._do_cast(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you move the fix into _do_cast?

Comment thread tests/test_codecs/test_cast_value.py Outdated

import numpy as np
import pytest
from numpy.ma.testutils import assert_array_equal

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
from numpy.ma.testutils import assert_array_equal
from numpy.testing import assert_array_equal

Comment thread tests/test_codecs/test_cast_value.py Outdated
]
)

# Write should be ok

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure we need these comments -- the entire test should pass, right?

@d-v-b

d-v-b commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

thank you for this! can you add a release note?

@github-actions github-actions Bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Aug 5, 2026
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.

2 participants