Skip to content

Fix slicing converted Java lists - #94

Open
Shubham-Padkonde wants to merge 1 commit into
scijava:mainfrom
Shubham-Padkonde:fix/java-list-slices
Open

Shubham-Padkonde wants to merge 1 commit into
scijava:mainfrom
Shubham-Padkonde:fix/java-list-slices

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Sep 29, 2026 •

Copy link
Copy Markdown

Fixes #24.

Slicing the list-like result of to_python(java_list) currently passes a Python slice to Java's integer-only List.get, raising TypeError. Handle slices using their normalized indices and the existing per-element conversion path, returning a Python list. This supports omitted and negative bounds, negative steps, empty slices, and the usual ValueError for a zero step without changing integer indexing.

Added JVM-backed regression tests for those cases, empty lists, and Java objects without a Python converter. Nine initial regression cases fail before the fix. All 45 conversion, array, basic, type, and inspection tests pass on Windows/Python 3.13/Java 26; Ruff lint and formatting pass. Those focused tests use standard Java classes with the unrelated Maven endpoints cleared. The full suite did not finish during local verification and was interrupted while resolving the larger ImageJ dependency set; its result remains unverified.

Prepared with Codex assistance.

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.

Slicing a Python list converted from Java fails

1 participant