gh-105689: Parse only the current statement in the IDLE Shell - #157594
Conversation
Since the prompts moved to the sidebar, sys.ps1 ends with a newline and prompt_last_line is empty, so HyperParser and newline_and_indent took the editor path in the Shell and parsed previous output. Use an explicit is_shell attribute instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The space indent patch was developed in parallel with and partially as an alternative to Tal Einat's proposed sidebar (issue #82084). The original intent of my patch was to move the default prompt '>>>\n', possibly replaced by sys.ps1, to it own line so as to enable the indent change. When the two patches worked so well together, we dropped the idea of adding an option for an own-line prompt instead of the sidebar. That idea is why the self.ps1 and self.prompt lines remain around the line removed. They can go in a separate cleanup patch as I am ready to merge this. I wish I had added a clear 'I am Shell' variable in my patch. |
|
Thanks @serhiy-storchaka for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-157650 is a backport of this pull request to the 3.15 branch. |
|
GH-157651 is a backport of this pull request to the 3.14 branch. |
|
GH-157652 is a backport of this pull request to the 3.13 branch. |
…H-157594) (#157652) gh-105689: Parse only the current statement in the IDLE Shell (GH-157594) Since the prompts moved to the sidebar, sys.ps1 ends with a newline and prompt_last_line is empty, so HyperParser and newline_and_indent took the editor path in the Shell and parsed previous output. Use an explicit is_shell attribute instead. (cherry picked from commit b42dcf6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…H-157594) (#157651) gh-105689: Parse only the current statement in the IDLE Shell (GH-157594) Since the prompts moved to the sidebar, sys.ps1 ends with a newline and prompt_last_line is empty, so HyperParser and newline_and_indent took the editor path in the Shell and parsed previous output. Use an explicit is_shell attribute instead. (cherry picked from commit b42dcf6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
A bug in the conversion of a Shell indents from a literal tab to (default) 4 spaces (PR #25678, issue #82073) resulted in
HyperParserandnewline_and_indent_eventtaking the editor path in the Shell and scanning back through previous output. Unbalanced quotes or parentheses in that output — a traceback forraise ValueError("""\n"""), aSyntaxError: '(' was never closed— then broke calltips, parenthesis matching and auto-indent for everything typed afterwards. Use an explicitis_shellattribute and parse only the current statement in the Shell, as before 3.10. This also fixes the Shell examples of #124451.🤖 Generated with Claude Code