Fix syntax error handling on Python 3.13 (#18656)
Summary of the issue:
When generating a syntax erro in a Python 3.13 Python console, the following is logged:
ERROR - unhandled exception (09:14:31.494) - MainThread (11952):
Traceback (most recent call last):
File "code.pyc", line 65, in runsource
File "pythonConsole.pyc", line 143, in __call__
File "codeop.pyc", line 155, in __call__
File "codeop.pyc", line 75, in _maybe_compile
File "codeop.pyc", line 118, in __call__
File "<console>", line 1
fl@
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pythonConsole.pyc", line 509, in onInputChar
File "pythonConsole.pyc", line 385, in execute
File "pythonConsole.pyc", line 196, in push
File "code.pyc", line 314, in push
File "code.pyc", line 68, in runsource
TypeError: PythonConsole.showsyntaxerror() got an unexpected keyword argument 'source'
Description of user facing changes:
Python console no longer breaks on syntax errors on Python 3.13 builds.
Description of developer facing changes:
None
Description of development approach:
Python 3.13 added **kwargs to the showsyntaxerror method. Adding this shouldn't do any harm on Python 3.11. kwargs will always be empty there and it's not problematic to pass a **kwargs to a non-kwargs supporting function when kwargs is empty.