Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions web/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -331,10 +333,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)
Expand Down
Loading