Repository navigation
fix(indexing): treat an empty list as an empty integer selection - #4518
XXXXXQ-0206 wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4518 +/- ##
=======================================
Coverage 94.90% 94.90%
=======================================
Files 96 96
Lines 14051 14051
=======================================
Hits 13335 13335
Misses 716 716
🚀 New features to boost your workflow:
|
202518f to
d018fdd
Compare
|
Addressed both review points in |
|
The two requested changes are in |
eb8f129 to
c5d52d8
Compare
|
I also rebased the branch onto the latest |
Summary
arr[[]]raisesIndexError: unsupported selection item for basic indexing.IntSequence(declared atsrc/zarr/core/indexing.py:42) includeslist[int], so an empty list is a valid selection. Cause:is_integer_list(:233) andis_bool_list(:238) both requirelen(x) > 0, so an empty list falls through toBasicIndexer, which accepts only int and slice.The change drops
len(x) > 0fromis_integer_listonly, and makesreplace_listsusenp.intpfor an empty list (it otherwise infers float64).is_bool_listkeeps its guard, so an empty list stays an empty integer selection rather than an empty mask, as in NumPy.The new test covers empty lists in bare, tuple,
oindexandvindexforms, plus the empty-array, boolean-list and write controls.For reviewers
The boolean-list guard is deliberately unchanged — please check that leaving
is_bool_listuntouched is how you want[]disambiguated.Author attestation
TODO
docs/user-guide/*.mdchanges/