https://github.com/python/cpython/commit/d791b9815a64c99991fcfd2f8408fc0b7ddb00bd
commit: d791b9815a64c99991fcfd2f8408fc0b7ddb00bd
branch: main
author: Irit Katriel <[email protected]>
committer: iritkatriel <[email protected]>
date: 2024-07-26T18:40:36Z
summary:

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

files:
M Lib/test/test_syntax.py
M Misc/NEWS.d/next/Core and 
Builtins/2024-07-24-22-39-07.gh-issue-122245.LVa9v8.rst

diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 4421d03a6d2206..206b7f0088a925 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -2265,6 +2265,10 @@ def f(x: *b)
    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 453c45e2f7ae3f..fff99b4992e321 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).

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to