mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
The 3.1 compiler don't check for keyword assignments in all places.
Find another way to generate a SyntaxError in the tests. Previously, these statements would raise something strange like TypeError: "'int' object is not iterable"
This commit is contained in:
parent
a1e5c69d5b
commit
72356338cb
1 changed files with 6 additions and 16 deletions
|
@ -478,32 +478,22 @@ SyntaxError: keyword argument repeated
|
|||
|
||||
Corner-cases that used to fail to raise the correct error:
|
||||
|
||||
>>> def f(*, x=lambda __debug__:0): pass
|
||||
>>> def f(*, x=lambda *:0): pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: assignment to keyword
|
||||
SyntaxError: named arguments must follow bare *
|
||||
|
||||
>>> def f(*args:(lambda __debug__:0)): pass
|
||||
>>> def f(*args:(lambda *:0)): pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: assignment to keyword
|
||||
SyntaxError: named arguments must follow bare *
|
||||
|
||||
>>> def f(**kwargs:(lambda __debug__:0)): pass
|
||||
>>> def f(**kwargs:(lambda *:0)): pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: assignment to keyword
|
||||
SyntaxError: named arguments must follow bare *
|
||||
|
||||
>>> with (lambda *:0): pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: named arguments must follow bare *
|
||||
|
||||
Corner-cases that used to crash:
|
||||
|
||||
>>> def f(**__debug__): pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: assignment to keyword
|
||||
|
||||
>>> def f(*xx, __debug__): pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: assignment to keyword
|
||||
|
||||
"""
|
||||
|
||||
import re
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue