summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2024-07-26 18:40:36 (GMT)
committerGitHub <noreply@github.com>2024-07-26 18:40:36 (GMT)
commitd791b9815a64c99991fcfd2f8408fc0b7ddb00bd (patch)
tree2c1ff3e4dce1188a6014466039217bc20177a3b5
parent1ca99ed240e1e70502d84fea274423b660d172c2 (diff)
downloadcpython-d791b9815a64c99991fcfd2f8408fc0b7ddb00bd.zip
cpython-d791b9815a64c99991fcfd2f8408fc0b7ddb00bd.tar.gz
cpython-d791b9815a64c99991fcfd2f8408fc0b7ddb00bd.tar.bz2
gh-122245: Add test case of generic type with __debug__ (#122322)
-rw-r--r--Lib/test/test_syntax.py4
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2024-07-24-22-39-07.gh-issue-122245.LVa9v8.rst4
2 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 4421d03..206b7f0 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -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):
...
diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-07-24-22-39-07.gh-issue-122245.LVa9v8.rst b/Misc/NEWS.d/next/Core and Builtins/2024-07-24-22-39-07.gh-issue-122245.LVa9v8.rst
index 453c45e..fff99b4 100644
--- a/Misc/NEWS.d/next/Core and Builtins/2024-07-24-22-39-07.gh-issue-122245.LVa9v8.rst
+++ b/Misc/NEWS.d/next/Core and Builtins/2024-07-24-22-39-07.gh-issue-122245.LVa9v8.rst
@@ -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).