Repository navigation
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Please do not randomly update to main, when not updating PR code, as it is nearly always a waste of CI resources. Closing along with the issue. |
|
Thank you for the clarification. I clicked GitHub's "Update branch" button because it indicated that my branch was out of date. I wasn't aware that doing so without code changes would trigger unnecessary CI runs. I'll be more mindful of this in future contributions. I also understand your reasoning for keeping editor syntax errors in the editor rather than displaying them in the Shell. Thanks for taking the time to explain. |
|
For python/cpython, with multiple merges per day, it is a crying-wolf situation. Every PR becomes 'out-of-date' in a few hours. Perhaps the devguide should explain this. And mention to not continually update. The real concern is when another merge makes a PR unmergeable due to conflict. |
Summary
Display full syntax error diagnostics in the IDLE Shell instead of showing a short error message in a modal dialog.
Motivation
One of IDLE's strengths is its simplicity. It is lightweight, included with Python, and convenient for quick experiments and learning.
However, when a syntax error occurs, IDLE currently displays only a short message in a modal dialog. Useful diagnostic information already provided by Python—such as the filename, line number, offending source code, and error position—is not shown.
This makes syntax errors unnecessarily difficult to diagnose, particularly for beginners who may not yet know how to locate the source of an error.
Displaying standard Python syntax error diagnostics also has an educational benefit. It helps beginners become familiar with the error messages they will encounter in terminals and other development environments.
The goal is to preserve IDLE's simplicity while making its error reporting more informative and useful.
Changes
SyntaxErrordiagnostics in the IDLE Shell usingtraceback.format_exception_only().Testing
Tested against the current CPython
mainbranch on Windows.python -m test test_idle— passed (332 tests run, 87 skipped).python -m unittest idlelib.idle_test.test_runscript.ScriptBindingTest.test_checksyntax_reports_error_in_shell -v— passed.git diff --check— passed.Related issue
Related to #91312, which discusses making better use of extended syntax error location information in IDLE.
This PR addresses a complementary aspect: where and how syntax error diagnostics are presented to users.