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 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
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 terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

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
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
Copy link
Member

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 added needs backport to 3.7 type-bug An unexpected behavior, bug, or error labels Jan 31, 2020
@terryjreedy terryjreedy merged commit bfdeaa3 into python:master Jan 31, 2020
@miss-islington
Copy link
Contributor

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
Copy link

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

miss-islington pushed 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
Copy link

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

miss-islington pushed 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
Copy link

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>
shihai1991 pushed a commit to shihai1991/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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants