Goal
Make the interactive debugger console render a syntax error page instead of
raising, on Python 3.13 and newer.
Done when: evaluating an invalid expression (for example 1 +) in the
debugger console returns the rendered "Syntax Error" traceback HTML on every
supported Python version (3.9 through 3.14), and a test covers it.
Reproduction:
from backlash.console import Console
Console({}, {}, None).eval('1 +')
Current behaviour:
- Python 3.9 - 3.12: returns the expected
<h3>Syntax Error</h3> page.
- Python 3.13 / 3.14: raises
TypeError: _InteractiveConsole.showsyntaxerror() got an unexpected keyword argument 'source'.
Cause: _InteractiveConsole.showsyntaxerror overrides the stdlib method with
the signature (self, filename=None). Since Python 3.13,
code.InteractiveInterpreter.runsource calls
self.showsyntaxerror(filename, source=source), so the override no longer
matches its caller.
Why
Any user who mistypes an expression in the in-browser debugger console gets an
unhandled exception instead of the error page, on the two most recent Python
releases. Typing a malformed expression is a routine action in an interactive
console, so this is likely to be hit on first use.
No test currently covers this path, so CI is green despite the breakage.
References
backlash/console.py (_InteractiveConsole.showsyntaxerror, _InteractiveConsole.runsource)
- stdlib
code.InteractiveInterpreter.runsource signature change in Python 3.13
tests/test_console.py may be a natural home for a regression test
Goal
Make the interactive debugger console render a syntax error page instead of
raising, on Python 3.13 and newer.
Done when: evaluating an invalid expression (for example
1 +) in thedebugger console returns the rendered "Syntax Error" traceback HTML on every
supported Python version (3.9 through 3.14), and a test covers it.
Reproduction:
Current behaviour:
<h3>Syntax Error</h3>page.TypeError: _InteractiveConsole.showsyntaxerror() got an unexpected keyword argument 'source'.Cause:
_InteractiveConsole.showsyntaxerroroverrides the stdlib method withthe signature
(self, filename=None). Since Python 3.13,code.InteractiveInterpreter.runsourcecallsself.showsyntaxerror(filename, source=source), so the override no longermatches its caller.
Why
Any user who mistypes an expression in the in-browser debugger console gets an
unhandled exception instead of the error page, on the two most recent Python
releases. Typing a malformed expression is a routine action in an interactive
console, so this is likely to be hit on first use.
No test currently covers this path, so CI is green despite the breakage.
References
backlash/console.py(_InteractiveConsole.showsyntaxerror,_InteractiveConsole.runsource)code.InteractiveInterpreter.runsourcesignature change in Python 3.13tests/test_console.pymay be a natural home for a regression test