Repository navigation
Commit 3ec687e
authored
fix: resolve chunks=-1 to chunk size 1 on zero-length axes (#4307)
* fix: resolve chunks=-1 to chunk size 1 on zero-length axes
The -1 chunk sentinel resolved to chunk size 0 on zero-length axes,
which broke every downstream sharding path differently: a ValueError
with shards=None, a ZeroDivisionError with shards="auto", and an
infinite loop with shards="auto" plus array.target_shard_size_bytes.
Clamp it to 1, matching the auto-chunking clamp in
_guess_regular_chunks.
Also guard _guess_num_chunks_per_axis_shard against zero-size chunk
shapes directly (same non-terminating-loop cause as the 0-d case fixed
in #4305), and fix the arithmetic in its docstring example.
Follow-up to #4305 / issue #4304.
Assisted-by: ClaudeCode:claude-fable-5-1
* docs: add changelog fragment
Assisted-by: ClaudeCode:claude-fable-5-11 parent 5e00e8c commit 3ec687e
3 files changed
Lines changed: 52 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
737 | | - | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
738 | 740 | | |
739 | 741 | | |
740 | 742 | | |
| |||
844 | 846 | | |
845 | 847 | | |
846 | 848 | | |
847 | | - | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
848 | 853 | | |
849 | 854 | | |
850 | 855 | | |
| |||
865 | 870 | | |
866 | 871 | | |
867 | 872 | | |
868 | | - | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
869 | 876 | | |
870 | 877 | | |
871 | 878 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
| |||
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
285 | | - | |
286 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
287 | 299 | | |
288 | 300 | | |
289 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
290 | 305 | | |
291 | 306 | | |
292 | 307 | | |
| |||
303 | 318 | | |
304 | 319 | | |
305 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
0 commit comments