Adds support for PEP-3132 'Extended Iterable Unpacking'
Support assignments of the form a, *b, c = 1, 2, 3, 4, 5, after which b is [2, 3, 4]. BUG: 362521 Differential revision: https://phabricator.kde.org/D1751 Fix assignments of the form a = b = 7, a = b = 3, 4. Fix assignment from a single-element tuple: foo = (3,) makes foo a tuple, not int. Fix unpacking into a single-element tuple: foo, = [7] makes foo an int, not a list. Fix unpacking of nested tuples: foo, (bar, baz) = 2, ('a', 5.5). BUG: 359914 Declaration aliasing works for simple "a = b" assignment, e.g. def aaa(a: int): return "a" bbb = aaa It _doesn't_ work for anything more advanced, e.g. def aaa(a: int): return "a" bbb, ccc = aaa, 4 although the function type is preserved. This is a regression, aliasing works for non-nested tuple assignment without this patch. The use case is however questionable and the benefit of these changes is certainly more valuable.
parent
583101e1
Please register or sign in to comment