Repository navigation
[3.7] bpo-40807: Show warnings once from codeop._maybe_compile (GH-20486) #20673
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
Merged
miss-islington
merged 3 commits into
python:3.7
from
miss-islington:backport-052d3fc-3.7
Jun 9, 2020
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2020-06-04-16-25-15.bpo-40807.yYyLWx.rst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Stop codeop._maybe_compile, used by code.InteractiveInterpreter (and IDLE). | ||
| from from emitting each warning three times. |
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.
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.
You forgot that the outer quotes are not part of the compiled syntax. (I have done this too.)
\eis a syntax error,'\e'is valid and gives no warning in 3.7.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.
Sorry about that. I was actually having trouble getting the '\e' to show the Deprecation Warning on any release until I started the REPL or IDLE with the
./python -Wall. I did this change quickly just to see how the tests would be run and it looks like I did it too quickly. :-(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.
The important point is
'\e'warns when starting IDLE (legitimately) withpy -3.7 -Wall -m idlelib. So the backport is needed.Should the tests always pass, not just with CI? At least if one does not explicitly turn off warnings for tests (which seems like a bad idea)? I made a local 3.7 branch from this PR and ran
python -m test test_codeopand it passed normally.python -m test.test_codeopreports 5 tests rather than the previous 4 and prints the DeprecationWarning.So I will merge and we will see how this fares on buildbots.
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.
20 seconds later I realize that warnings <= 1 is sufficient to prove not 3 or even 2. But 0 could also result from a bad patch that suppressed too much. So if a fix is needed, better to add a context forcing the warning on.