Skip to content

Conversation

@LeonarddeR
Copy link
Collaborator

@LeonarddeR LeonarddeR commented Aug 9, 2025

Link to issue number:

None

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.

Testing strategy:

  • Test generating a syntax error on Python 3.11 builds
  • Test generating a syntax error on Python 3.13 builds

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

Copilot AI review requested due to automatic review settings August 9, 2025 07:18
@LeonarddeR LeonarddeR requested a review from a team as a code owner August 9, 2025 07:18
@LeonarddeR LeonarddeR requested a review from SaschaCowley August 9, 2025 07:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a TypeError that occurs when handling syntax errors in the Python console on Python 3.13, where the showsyntaxerror method now accepts additional keyword arguments that were not previously supported.

Key Changes

  • Updated the showsyntaxerror method signature to accept **kwargs
  • Updated the copyright year to 2025
  • Ensured backward compatibility with earlier Python versions

@seanbudd seanbudd enabled auto-merge (squash) August 11, 2025 02:03
@seanbudd seanbudd merged commit 5198ed5 into nvaccess:master Aug 11, 2025
30 checks passed
@SaschaCowley SaschaCowley added this to the 2025.3 milestone Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants