gh-82005: Properly handle user input warnings in IDLE shell.#15311
gh-82005: Properly handle user input warnings in IDLE shell.#15311terryjreedy wants to merge 17 commits into
Conversation
Cease turning SyntaxWarnings into SyntaxErrors. Print warnings in the shell, not a possibly non-existent command line.
# Conflicts: # Lib/idlelib/pyshell.py
# Conflicts: # Lib/idlelib/pyshell.py
# Conflicts: # Lib/idlelib/pyshell.py
|
Thank you. I just fixed the merge conflict so I could get back to this. Will try to test soon. |
Sorry, something went wrong.
|
As for 'bug 2', warning printed before code (initial post): it does not look so bad now compared to alternatives. But the speculated reason is wrong. The same is true with multiple lines. But Bug 3: the warnings are printed with each return after the first, and there must be at least 2. So scratch what I said before. 'Once' must apply across Enters, and, I think, at least across inputs between restarts, if not the whole session. |
Sorry, something went wrong.
|
This missed the boat for inclusion in Python 3.9 which accepts security fixes only as of today. |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
Print warnings in the shell instead of the parent terminal, if there is one.
WIP Bug 1. Each warning printed 3 times. Will look in code.InteractiveInterpreter.
Bug 2. Warning inserted before code being warned about. My guess is that intercepted \n triggers compile which triggers warnings output before \n is passed to tk.Text to be inserted and move iomark. (I do not know when/where iomark is normally moved, but it seems not soon enough when compile warns). Shell.write changes gravity before and after calling OutputWindow.write, which I suspect moves the mark.