[Bugfix] WASM playground shows "Internal REPL Error" for every user error — traceback broken (missing _colorize) #392
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#392
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by the new #239 headless-browser test harness on its first run (part of #387).
Symptom
In the shipped web playground, any user code that raises — a syntax error (
def bad(), a runtime error (1/0), an explicitraise— returns the stringInternal REPL Error: Unknown error in capture codeinstead of the actual Python traceback. Non-raising code (1+1,print(...), object creation) works fine, and the interpreter recovers (subsequent evals succeed), so the bug is purely in error reporting. On desktop this path doesn't exist (ImGui REPL), so it's web-only and went unnoticed.Root cause
run_python_string_with_output(src/platform/EmscriptenStubs.cpp) wraps user code in a capture harness whose exception branch doesimport traceback; traceback.format_exc(). On the web build:Python 3.13+ made
tracebackunconditionallyimport _colorize(Lib/traceback.py:13). The hand-curated WASM stdlib bundlewasm_stdlib/lib/python3.14/(215 tracked files) includestraceback.pybut not_colorize.py. So the wrapper's own error-formatting import raises, that exception propagates out of the capture code, and the C++ side reports the generic "Internal REPL Error"._colorize.pyonly needsos,sys,collections.abc,dataclasses— all already bundled.Fix
_colorize.pytowasm_stdlib/lib/python3.14/(copy from__lib/Python/Lib/_colorize.py). Rebuild playground, redeploy.tracebackis ever unavailable — fall back totype(e).__name__ + ': ' + str(e)rather than turning every error into "Unknown error in capture code". A broken error-formatter shouldn't erase the error.Regression coverage
tests/wasm/run_wasm_tests.py(#239) already asserts syntax- and runtime-error tracebacks surface (syntax_error_recovery,runtime_error_recovery). Those two cases are RED against the current build and go GREEN once_colorizeis bundled — the harness is the regression test.