gh-122245: move checks for writes and shadowing of __debug__ to symtable#122246
Merged
iritkatriel merged 8 commits intopython:mainfrom Jul 26, 2024
Merged
gh-122245: move checks for writes and shadowing of __debug__ to symtable#122246iritkatriel merged 8 commits intopython:mainfrom
iritkatriel merged 8 commits intopython:mainfrom
Conversation
iritkatriel
commented
Jul 26, 2024
iritkatriel
commented
Jul 26, 2024
Member
JelleZijlstra
left a comment
There was a problem hiding this comment.
I started a review but never submitted it, sorry. None of these suggested changes seem crucial, but consider adding them if you like.
Comment on lines
+2264
to
+2267
| >>> type __debug__ = int | ||
| Traceback (most recent call last): | ||
| SyntaxError: cannot assign to __debug__ | ||
|
|
Member
There was a problem hiding this comment.
Suggested change
| >>> type __debug__ = int | |
| Traceback (most recent call last): | |
| SyntaxError: cannot assign to __debug__ | |
| >>> type __debug__ = int | |
| Traceback (most recent call last): | |
| SyntaxError: cannot assign to __debug__ | |
| >>> class A[__debug__]: pass | |
| Traceback (most recent call last): | |
| SyntaxError: cannot assign to __debug__ | |
In a similar vein
Member
Author
There was a problem hiding this comment.
Sorry, should have waited a bit longer. I'll add this.
| @@ -0,0 +1,4 @@ | |||
| Detection of writes to ``__debug__`` is moved from the compiler's codegen | |||
| stage to the symtable. This means that these errors now detected even in | |||
Member
There was a problem hiding this comment.
Suggested change
| stage to the symtable. This means that these errors now detected even in | |
| stage to the symtable. This means that these errors are now detected even in |
| Detection of writes to ``__debug__`` is moved from the compiler's codegen | ||
| stage to the symtable. This means that these errors now detected even in | ||
| code that is optimized away before codegen (such as assertions with the | ||
| :option:`-O` command line option.) |
Member
There was a problem hiding this comment.
Suggested change
| :option:`-O` command line option.) | |
| :option:`-O` command line option). |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #122245.