pylint-bot / test

0 stars 0 forks source link

Unpacking bug in protocols.starred_assignmed_stmts #239

Closed pylint-bot closed 8 years ago

pylint-bot commented 8 years ago

Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?)


Reproducing with this code. In this case, b can be inferred as an empty list, but the code instead raises an InferenceError when it gets to analyze it.

#!python

from astroid.test_utils import extract_node
n = extract_node('''
a, *b, c = 1, 2
b #@
''')
print(next(n.infer()))

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):


Fix a bug in the inference of Starred nodes

This bug occurs when the left hand side of an assignment has an extra element comparing with the right hand side, which makes the Starred node to not be inferred correctly as an empty List. Closes issue #239.