Skip to content

gh-122245: Add test case of generic type with __debug__ #122322

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
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Lib/test/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -2265,6 +2265,10 @@ def f(x: *b)
Traceback (most recent call last):
SyntaxError: cannot assign to __debug__

>>> class A[__debug__]: pass
Traceback (most recent call last):
SyntaxError: cannot assign to __debug__

>>> class A[T]((x := 3)): ...
Traceback (most recent call last):
...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +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
stage to the symtable. This means that these errors are now detected even in
code that is optimized away before codegen (such as assertions with the
:option:`-O` command line option.)
:option:`-O` command line option).
Loading