bpo-43017: Improve error message for unparenthesised tuples in comprehensions (GH24314)
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index c8d191d..604474f 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -235,6 +235,21 @@
Traceback (most recent call last):
SyntaxError: invalid syntax
+Comprehensions creating tuples without parentheses
+should produce a specialized error message:
+
+>>> [x,y for x,y in range(100)]
+Traceback (most recent call last):
+SyntaxError: did you forget parentheses around the comprehension target?
+
+>>> {x,y for x,y in range(100)}
+Traceback (most recent call last):
+SyntaxError: did you forget parentheses around the comprehension target?
+
+>>> {x,y: None for x,y in range(100)}
+Traceback (most recent call last):
+SyntaxError: did you forget parentheses around the comprehension target?
+
From compiler_complex_args():
>>> def f(None=1):