Blosc / Blosc/python-blosc2

[WASM] SChunk.__getitem__/get_slice raises RuntimeError on Pyodide 0.29.4 (works on 0.29.3 and 314.0.0)

Offen
#664 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
211
Forks
58
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
6

Beschreibung

## Summary
On the WASM/Pyodide build, slicing an **in-memory** `SChunk` that was loaded from
a frame fails with `RuntimeError: Error while getting the slice` — but **only
under Pyodide 0.29.4**. The same code passes on Pyodide **0.29.3** (cp313) and
**314.0.0** (cp314).

The wheel tag is `pyemscripten_2025_0_wasm32` (ABI-level), so a wheel built/tested
against 0.29.3 still runs on a user's 0.29.4 runtime — meaning this is a genuine
runtime failure for 0.29.4 users, not just a CI artifact.

## Reproducer
`tests/test_open.py::test_load_schunk_returns_in_memory_copy`:

```python
urlpath = tmp_path / "schunk.b2frame"
data = np.arange(20, dtype=np.int32)
blosc2.SChunk(data=data, urlpath=urlpath, mode="w",
cparams={"typesize": data.dtype.itemsize})
loaded = blosc2.load(urlpath) # in-memory copy, urlpath is None
assert loaded[:] == data.tobytes() # <-- RuntimeError here
```

## Traceback

schunk.py:1114 __getitem__ -> get_slice(item.start, item.stop)
schunk.py:1058 get_slice -> super().get_slice(start, stop, out)
blosc2_ext.pyx:2058 -> RuntimeError: Error while getting the slice

## Environment matrix

```
│ Python / ABI │ Pyodide │ Result │
│ cp313 / pyemscripten_2025_0 │ 0.29.3 │ ✅ pass │
│ cp313 / pyemscripten_2025_0 │ 0.29.4 │ ❌ RuntimeError │
│ cp314 / pyemscripten_2026_0 │ 314.0.0 │ ✅ pass │
```

## Current workaround

.github/workflows/cibuildwheels.yml pins CIBW_PYODIDE_VERSION: 0.29.3 for the
cp313 wasm job (cibuildwheel 4.1's default is 0.29.4). This keeps CI green and
matches the wheels wasm.yml already ships, but does not fix the runtime for
0.29.4 users.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit tests/test_open.py::test_load_schunk_returns_in_memory_copy und reproduziere den Fehler unter Pyodide 0.29.4. Untersuche anschließend den schunk.py-Pfad get_slice/__getitem__ und den im Traceback genannten blosc2_ext.pyx-Einstiegspunkt. Prüfe .github/workflows/cibuildwheels.yml und wasm.yml auf die Handhabung der Pyodide-Version. Als erledigt gilt dies, wenn das Slicing von im Speicher geladenen SChunks unter 0.29.4 funktioniert, ohne die bestehenden erfolgreichen Umgebungen 0.29.3 und 314.0.0 zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, wasm
Bereich
build-system, testing-qa
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.