Skip to content

Python 3: Write syntax errors and tracebacks to python console - #9767

Merged
michaelDCurran merged 1 commit into
nvaccess:threshold_py3_stagingfrom
LeonarddeR:py3_console
Jun 21, 2019
Merged

Python 3: Write syntax errors and tracebacks to python console#9767
michaelDCurran merged 1 commit into
nvaccess:threshold_py3_stagingfrom
LeonarddeR:py3_console

Conversation

@LeonarddeR

@LeonarddeR LeonarddeR commented Jun 17, 2019

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #9073

Summary of the issue:

In python 3, code.InteractiveConsole.showtraceback/showsyntaxerror will print output to sys.excepthook instead of directly to the console. This results in tracebacks being printed to the NVDA log instead of to our python console.

Description of how this pull request fixes the issue:

Inspired by how we implement the push method, showtraceback and showsyntaxerror now save sys.excepthook, restore it to sys.excepthook call super and then set it back to the initial value before calling the show method.

Testing performed:

Tested that syntax errors and tracebacks generated on the python console are shown as in NVDA on Python 2.

Known issues with pull request:

None

@josephsl

Copy link
Copy Markdown
Contributor

Hi,

Working as advertised.

Thanks.

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.

4 participants