mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-122245: Add test case of generic type with __debug__ (#122322)
This commit is contained in:
parent
1ca99ed240
commit
d791b9815a
2 changed files with 6 additions and 2 deletions
|
@ -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):
|
||||
...
|
||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue