bpo-32023: Disallow genexprs without parenthesis in class definitions. (#4400)

This commit is contained in:
Serhiy Storchaka 2017-11-15 17:39:37 +02:00 committed by GitHub
parent edad8eebee
commit ddbce13786
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 7 deletions

View file

@ -153,6 +153,10 @@ Traceback (most recent call last):
SyntaxError: Generator expression must be parenthesized
>>> f((x for x in L), 1)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> class C(x for x in L):
... pass
Traceback (most recent call last):
SyntaxError: invalid syntax
>>> def g(*args, **kwargs):
... print(args, sorted(kwargs.items()))