Repository navigation
Accept read-only input in corner_fast, corner_moravec and corner_orientations - #8424
Merged
Merged
Conversation
…tions The Cython kernels only read their inputs, but non-const memoryviews ask for a writable buffer, so read-only arrays raised "ValueError: buffer source array is read-only". Assisted-by: Claude Code:claude-opus-5-5
stefanv
approved these changes
Nov 19, 2026
Member
|
Thanks you for the fix, @darskkaa! Do you also want to take a stab at the others in another PR? |
Contributor
Author
stefanv
pushed a commit
that referenced
this pull request
Nov 21, 2026
Part of #8423, follow-up to #8424. This is the same fix as #8424. Here I made the read-only inputs `const` in the denoise, inpaint, radon and max_tree kernels, where the inpaint mask is `const unsigned char`, since `const char` does not accept bool arrays. I also left out `unwrap_phase`, as it involved changing the vendored C code. AI usage: I used Claude Code to make the `const` changes, then reviewed them and ran some existing tests locally.
This was referenced Nov 24, 2026
eliem08
added a commit
to eliem08/scikit-image
that referenced
this pull request
Nov 24, 2026
… pass on main Drop the 7 new read-only tests that already pass on upstream main (scikit-image#8424/scikit-image#8426 landed the underlying fixes); only unwrap_phase and ORB still fail there. Keeps test_unwrap_phase_read_only, test_unwrap_phase_read_only_nan and test_orb_read_only. Signed-off-by: Ilyass Emssaad <[email protected]>
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.
This fixes #8418, #8419 and #8420.
corner_fast,corner_moravecandcorner_orientationsraisedValueError: buffer source array is read-onlyfor read-only arrays. Their Cython kernels only read the input, so the memoryview arguments are nowconst, like inutil/_remap.pyx. Thecornersargument ofcorner_orientationsis passed straight through, so it getsconstas well.#8423 seems to list more functions with the same problem, so I chose to keep this PR to the corner kernels. No existing test covers read-only input; I can add a regression test if you'd like one.
AI use: Claude Code wrote the
constchange. I reviewed it, made sure read-only input works for all three functions, and ran the existing corner and ORB tests locally.