Skip to content

Accept read-only input in more Cython kernels - #8426

Merged
stefanv merged 1 commit into
scikit-image:mainfrom
darskkaa:readonly-8423
Nov 21, 2026
Merged

stefanv merged 1 commit into
scikit-image:mainfrom
darskkaa:readonly-8423

Conversation

@darskkaa

Copy link
Copy Markdown
Contributor

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.

denoise_bilateral, denoise_tv_bregman, inpaint_biharmonic (mask),
iradon_sart, area_opening, diameter_opening, max_tree and
max_tree_local_maxima raised "buffer source array is read-only" for
read-only arrays. The kernels only read these inputs, so the
memoryviews are now const. The inpaint mask uses unsigned char because
a const char memoryview does not accept bool arrays.

Assisted-by: Claude Code:claude-opus-5-5
@stefanv
stefanv merged commit 9af8353 into scikit-image:main Nov 21, 2026
35 checks passed
@stefanv

stefanv commented Nov 21, 2026

Copy link
Copy Markdown
Member

Thanks for this follow-up, @darskkaa 🙏

@github-actions github-actions Bot added this to the 0.27 milestone Nov 21, 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]>
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