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

This commit is contained in:
Irit Katriel 2024-07-26 19:40:36 +01:00 committed by GitHub
parent 1ca99ed240
commit d791b9815a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -2265,6 +2265,10 @@ Invalid expressions in type scopes:
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):
...

View File

@ -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).