Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-38792: Remove IDLE shell calltip before new prompt. #17150

Merged
merged 6 commits into from Jan 31, 2020

Conversation

@ZackerySpytz
Copy link
Contributor

ZackerySpytz commented Nov 14, 2019

Previously, a calltip might be left after SyntaxError, KeyboardInterrupt, or Shell Restart..

https://bugs.python.org/issue38792

Calltips should be removed if a KeyboardInterrupt occurs.
@taleinat

This comment has been minimized.

Copy link
Contributor

taleinat commented Nov 14, 2019

Hi Zack, thanks for this!

This doesn't go far enough, actually; we should make sure to close the calltip in other cases too, such as restarting the shell or hitting return to running a statement / block. It is a bit hairy to see where the best place to add this is.

Let me know if you're interested in doing more work on this and testing various edge cases.

Copy link
Member

terryjreedy left a comment

I tested interrupts and restarts before, during, and after calltips. Before and after had no new problems and during now works properly. I also tested some in editor. Zack, thanks for report and initial fix. I plan to merge tomorrow.

@taleinat If you find a way to execute with Enter and have calltip persist, we can try to fix in another PR, making sure to not regress in editor.

@taleinat

This comment has been minimized.

Copy link
Contributor

taleinat commented Jan 30, 2020

Even with this fix, it is still easy and common to get a calltip staying open in other ways. For example, hitting Enter in the shell with a calltip open and a syntax error, as in the following image:

Screen Shot 2020-01-30 at 12 59 57

Removing any open call-tips in PyShell.resetoutput() could be a more comprehensive solution to these issues. I'm testing it locally now.

taleinat added 2 commits Jan 30, 2020
@taleinat

This comment has been minimized.

Copy link
Contributor

taleinat commented Jan 30, 2020

Removing any open call-tips in PyShell.resetoutput() could be a more comprehensive solution to these issues. I'm testing it locally now.

This looks to be working very nicely. I've pushed this change into this PR, I hope you like it!

@terryjreedy terryjreedy changed the title bpo-38792: IDLE calltips may not properly close on KeyboardInterrupt bpo-38792: Remove IDLE shell calltip before new prompt. Jan 31, 2020
@terryjreedy

This comment has been minimized.

Copy link
Member

terryjreedy commented Jan 31, 2020

I got the same with int(',. This should be seen as hitting return to continue on a new line, not to run. But the syntax error causes a new prompt. It is plausible that the calltip should disappear, though if one follows with Alt-P <>, then one might want it.

I like handling this in one place. Among other reasons, Zack originally used refresh calltip event rather than remove calltip window. I switched because I don't believe the extra code in the former is needed. (refresh_calltip_event is only triggered by and not by other actions that close a calltip.) But if I am wrong, the fix would only be needed one place.

@terryjreedy terryjreedy merged commit bfdeaa3 into python:master Jan 31, 2020
9 checks passed
9 checks passed
Docs
Details
Windows (x86)
Details
Windows (x64)
Details
macOS
Details
Ubuntu
Details
Azure Pipelines PR #20200130.45 succeeded
Details
bedevere/issue-number Issue number 38792 found
Details
bedevere/news News entry found in Misc/NEWS.d
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Jan 31, 2020

Thanks @ZackerySpytz for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒🤖

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jan 31, 2020

@terryjreedy: Please replace # with GH- in the commit message next time. Thanks!

miss-islington added a commit to miss-islington/cpython that referenced this pull request Jan 31, 2020
Previously, a calltip might be left after SyntaxError, KeyboardInterrupt, or Shell Restart.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tal Einat <taleinat+github@gmail.com>
(cherry picked from commit bfdeaa3)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jan 31, 2020

GH-18287 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit to miss-islington/cpython that referenced this pull request Jan 31, 2020
Previously, a calltip might be left after SyntaxError, KeyboardInterrupt, or Shell Restart.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tal Einat <taleinat+github@gmail.com>
(cherry picked from commit bfdeaa3)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jan 31, 2020

GH-18288 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Jan 31, 2020
Previously, a calltip might be left after SyntaxError, KeyboardInterrupt, or Shell Restart.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tal Einat <taleinat+github@gmail.com>
(cherry picked from commit bfdeaa3)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
miss-islington added a commit that referenced this pull request Jan 31, 2020
Previously, a calltip might be left after SyntaxError, KeyboardInterrupt, or Shell Restart.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tal Einat <taleinat+github@gmail.com>
(cherry picked from commit bfdeaa3)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.