Repository navigation
Conversation
`check_out_param` flattens `out` with `reshape`, which returns a copy when numpy cannot flatten the array as a view. The decoders then filled that copy and returned the caller's `out` unchanged. They now copy the decoded items back into `out` when it was flattened into a copy. A read-only `out` of such a layout raises `ValueError`. Assisted-by: ClaudeCode:claude-fable-5.2
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #917 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 1196 1196
=========================================
Hits 1196 1196 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
The VLen codecs (
VLenUTF8,VLenBytesandVLenArray) fill a non-contiguousoutpassed todecode. For layouts that numpy cannot flatten without a copy they decoded into that copy and returnedoutunchanged. If such anoutis read-only they raiseValueError.Relationship to #916
decodereturn the caller'sout.mainthen gets merged into fix: restore behavior the typing changes broke and correct wrong stubs and annotations #916, where the same change and the same test file drop out of that diff.What was wrong, and the change
check_out_paramflattensoutwithout.reshape(-1, order='A'). For an array such asbase[::2](every other row), numpy cannot do that as a view and returns a copy.main, sincedecode(buf, out=out)returnsoutitself, the caller gets back its own array, untouched, and no error.decodenow copies the items back intooutwhen the flattened array does not share memory with it. An emptyoutis left alone, so an empty read-onlyoutstill works.outraisesValueError("assignment destination is read-only"): the items cannot be stored, and returningoutunfilled would be wrong data.Tests
tests/test_vlen_out.py, for all three codecs: five layouts that numpy cannot flatten as a view (the test asserts that), checking thatoutis returned, holds the decoded items in C order, and that the memory around it is untouched; the read-only refusal; and the empty read-only case.mainand all pass on this branch; the full suite passes on this branch (894 passed, without the optional zfpy and pcodec); ruff and mypy are clean.🤖 Generated with Claude Code