Diagnostics and Tracebacks
Edit this pageSyntax and runtime diagnostic behavior in PYRS tracebacks.
PYRS emits CPython-shaped traceback output for syntax and runtime failures, including source context and caret spans where source location data is available.
Runtime Traceback Shape
| Element | Behavior |
|---|---|
| Frame lines | File … , line N, in … style output with ordered frame stack. |
| Source context | Source line and caret span render when location text is available. |
| Exception footer | Typed footer formatting follows CPython conventions (including key exception text behaviors). |
| Cause/context chain | Direct cause and context sections are emitted in CPython-style traceback chaining flow. |
Syntax Diagnostics
Syntax Diagnostics Example
>>> def broken( ... pass File "<stdin>", line 2 pass ^^^^ SyntaxError: invalid syntax Parser and semantic syntax failures are surfaced as SyntaxError-style diagnostics with file/line
context and CPython-oriented message classes.
Error-Report Expectations
- Unhandled exceptions should preserve original exception type, not wrap traceback text in a new runtime error.
- Re-raised exceptions should preserve traceback-chain fidelity for the original fault context.
- Diff tests are used to keep traceback shape aligned with CPython behavior over time.