]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-122245: Add test case of generic type with __debug__ (#122322)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Fri, 26 Jul 2024 18:40:36 +0000 (19:40 +0100)
committerGitHub <noreply@github.com>
Fri, 26 Jul 2024 18:40:36 +0000 (18:40 +0000)
Lib/test/test_syntax.py
Misc/NEWS.d/next/Core and Builtins/2024-07-24-22-39-07.gh-issue-122245.LVa9v8.rst

index 4421d03a6d2206e338511f8448b0b6437e16eef8..206b7f0088a925fffb71bbec791096639e0a72d8 100644 (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):
       ...
index 453c45e2f7ae3f1b8d757e298e276321d28a5363..fff99b4992e321e227c25e654e722f3a7707b7f2 100644 (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).