pytype
pytype copied to clipboard
Invalid [bad-unpacking] error when using "catch-all"
When using a "catch-all" with unpacking, pytype incorrectly reports a [bad-unpacking] error.
As a simple case:
first, *rest = ["foo"]
This is valid, where first is assigned "foo" and rest is assigned [], but pytype reports:
Cannot unpack 1 value into 2 variables [bad-unpacking]
When pytype analyzes such unpacking, it should not count the "catch-all" on the LHS (if there is one) in its variable count for comparison to the length of the value on the RHS.
Conversely, in the following case, Python will produce a ValueError, but pytype does not produce an error:
first, *rest = []
thanks, looks like we have some errors in our sequence unpacking logic!
Looks like this is fixed!