-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-82005: Properly handle user input warnings in IDLE shell. #15311
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
Open
terryjreedy
wants to merge
17
commits into
python:main
Choose a base branch
from
terryjreedy:warn
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+18
−18
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
eb87bcd
bpo-37824: Properly handle user input warnings in IDLE shell.
terryjreedy be17e41
Revern warning_stream when Shell closes.
terryjreedy 54edc23
Stop printing bogus prompt after warning.
terryjreedy 73aaf87
Merge branch 'master' into warn
terryjreedy a82437d
Merge remote-tracking branch 'origin/master' into warn
terryjreedy 12e292b
Merge remote-tracking branch 'origin/master' into warn
terryjreedy 0fade74
Adjust test to changed warning format.
terryjreedy d45b1e0
Merge remote-tracking branch 'origin/warn' into warn
terryjreedy 8d4d9bb
bpo-37309: Update IDLE NEWS.txt
terryjreedy 83c713a
Merge remote-tracking branch 'upstream/master'
terryjreedy 0ae61bc
Merge remote-tracking branch 'upstream/master'
terryjreedy b2ebe5c
Merge remote-tracking branch 'origin/master' into warn
terryjreedy a20cf7c
Show warnings once
csabella 497298c
Merge remote-tracking branch 'upstream/master' into warn
terryjreedy b72612a
Merge branch 'warn' of https://github.com/terryjreedy/cpython into warn
terryjreedy d5849ad
Clean PyShell.runsource of unneeded assert and comments.
terryjreedy d250b71
Merge branch 'main' into warn
terryjreedy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
Just remember to remove the commented out code above before merging...
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I created the PR on 2019 Aug 16, runsource comprised stuffsource(), a comment and assert, the inactivated code, and a try-finally block that wapped the override comment II.runsource() and and that fiddled with warnings in 'finally'.
The comment and assert were added and the code inactivated by MvL in 2007. The commit message was "Expect that source strings are unicode". Since str was bytes at the time, the message, comment, and assert do not make much sense to me. In any case, the comment and assert can be deleted. If IDLE were to pass bytes, there would be an error anyway.
I removed the inactivated code on Sept 16 in #16198 for bpo-38183 as an unrelated change. (A separate PR would have been better.) I only left it in the merge resolution because I was not sure then it should go (it should).
The try-finally was from KBK in 2001 and 2004. On Aug 26, in #15500 for this same issue (bpo-37824), I redid shell warnings and removed 'try' and the finally block, leaving the comment and II.runsource(). As for Cheryl's addition of a warnings filter, I will test and see if it should go in the warnings code to be executed just once and before running any user code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that II.runsource is only use for code input after '>>>'. For instance, 'python -m idlelib -c "0 is "' only prints the warning once even without the filter. The patch otherwise moves it from the console to Shell. The current file level warnings manipulation does not save and restore filters. So I will leave the filter here until such time as code or codeop are patched (see issue) to make it unneeded in IDLE.