mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix crasher in unpacking assignments with star, where the size constraints
weren't checked.
This commit is contained in:
parent
4a983c550e
commit
deef67481c
2 changed files with 27 additions and 0 deletions
|
@ -143,6 +143,23 @@ Now some general starred expressions (all fail).
|
|||
...
|
||||
SyntaxError: can use starred expression only as assignment target
|
||||
|
||||
Some size constraints (all fail.)
|
||||
|
||||
>>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range(1<<8 + 1)"
|
||||
>>> compile(s, 'test', 'exec') # doctest:+ELLIPSIS
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
SyntaxError: too many expressions in star-unpacking assignment
|
||||
|
||||
>>> s = ", ".join("a%d" % i for i in range(1<<8 + 1)) + ", *rest = range(1<<8 + 2)"
|
||||
>>> compile(s, 'test', 'exec') # doctest:+ELLIPSIS
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
SyntaxError: too many expressions in star-unpacking assignment
|
||||
|
||||
(there is an additional limit, on the number of expressions after the
|
||||
'*rest', but it's 1<<24 and testing it takes too much memory.)
|
||||
|
||||
"""
|
||||
|
||||
__test__ = {'doctests' : doctests}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue