From 1189173de29a646bd219c25a0f2be01eae0d21f5 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 25 Apr 2026 21:21:10 +0100 Subject: [PATCH 1/2] `optimize_cfg` has been fixed --- web/driver.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/web/driver.py b/web/driver.py index 183489c..8e7c7f6 100644 --- a/web/driver.py +++ b/web/driver.py @@ -331,10 +331,7 @@ def view_pseudo(code: str, *, optimize: bool = False) -> dict[str, Any]: co_consts = _merge_co_consts( _co_consts_from_metadata(metadata), _compiled_co_consts(code) ) - # On some newer WASM builds (e.g. CPython 3.15 snapshots), optimize_cfg can - # trap at runtime with low-level wasm errors. Prefer a stable pseudo view - # there instead of crashing the whole worker process. - if optimize and sys.version_info < (3, 15): + if optimize: insts = optimize_cfg(insts, co_consts, 0) items = _instruction_items(insts) adjusted_consts = _apply_annotations_const_workaround(items, co_consts) From bbba21da3cb40484bc71c0df3a054863c8f61562 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sun, 26 Apr 2026 12:14:56 +0100 Subject: [PATCH 2/2] Fix consts --- web/driver.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/driver.py b/web/driver.py index 8e7c7f6..745a612 100644 --- a/web/driver.py +++ b/web/driver.py @@ -211,6 +211,8 @@ def _co_consts_from_metadata(metadata): if not metadata: return None consts = metadata.get("consts") + if isinstance(consts, list): + return list(consts) if consts else None if not isinstance(consts, dict) or not consts: return None # compiler metadata stores const->index and indices may be sparse.