Skip to content

Combiner.__init__ builds a nested Array via xp.asarray([ccd.data ...]); array-api-strict requires xp.stack (44 failures) #965

Description

@mwcraig

Under CCDPROC_ARRAY_LIBRARY=array-api-strict (triage tooling from #937/#939, branch array-api-strict-triage-tooling), 44 of the 63 failures in ccdproc/tests/test_combiner.py (63 failed, 11 passed total) trace to a single line in Combiner.__init__. This is the biggest single failure source in the #941 escape-site table.

Offending codeccdproc/combiner.py:189:

# set up the data array
self._data_arr = xp.asarray([ccd.data for ccd in ccd_list], dtype=dtype)

Root cause: each ccd.data is already an array_api_strict.Array. Passing a Python list of Array objects to xp.asarray triggers array-api-strict's explicit guard against nested arrays — it refuses to infer a stacking axis and requires xp.stack instead.

Representative traceback:

ccdproc/tests/test_combiner.py:87: in test_combiner_create
    c = Combiner(ccd_list)
ccdproc/combiner.py:189: in __init__
    self._data_arr = xp.asarray([ccd.data for ccd in ccd_list], dtype=dtype)
array_api_strict/_creation_functions.py:101: in asarray
    raise TypeError("Nested Arrays are not allowed. Use `stack` instead.")
E   TypeError: Nested Arrays are not allowed. Use `stack` instead.

Suggested fix: replace the list-comprehension + asarray with xp.stack([ccd.data for ccd in ccd_list], axis=0) (casting dtype separately via xp.astype if needed). The mask construction at combiner.py:196 (self._data_arr_mask = xp.asarray(mask_list, dtype=bool)) has the identical pattern and will hit the same error once the data-array construction is fixed, so it should be converted at the same time.

This is likely also the biggest CuPy failure source, since CuPy hits the same nested-array conversion path.

Part of the array-API triage in #941; found with the array-api-strict tooling from #937/#939. Verified at branch tip d329ac5 (2026-08-01): failure count and line number confirmed by re-running the suite and grepping tracebacks.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions