mirror of https://github.com/python/cpython
gh-122245: Add test case of generic type with __debug__ (#122322)
This commit is contained in:
parent
1ca99ed240
commit
d791b9815a
|
@ -2265,6 +2265,10 @@ Invalid expressions in type scopes:
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
SyntaxError: cannot assign to __debug__
|
SyntaxError: cannot assign to __debug__
|
||||||
|
|
||||||
|
>>> class A[__debug__]: pass
|
||||||
|
Traceback (most recent call last):
|
||||||
|
SyntaxError: cannot assign to __debug__
|
||||||
|
|
||||||
>>> class A[T]((x := 3)): ...
|
>>> class A[T]((x := 3)): ...
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Detection of writes to ``__debug__`` is moved from the compiler's codegen
|
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
|
code that is optimized away before codegen (such as assertions with the
|
||||||
:option:`-O` command line option.)
|
:option:`-O` command line option).
|
||||||
|
|
Loading…
Reference in New Issue