pylint-bot / test

0 stars 0 forks source link

List multiplication results in weird results when inferring #271

Open pylint-bot opened 8 years ago

pylint-bot commented 8 years ago

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


#!python

from astroid.test_utils import extract_node
n = extract_node('''
def foo(arg):
    return [arg] * 2
''')
x = n.body[0].value
i = next(x.infer())
print(i, x)
print(i.as_string())

This prints [2, 2], when something as '[Uninferable, Uninferable]' was expected instead. I don't know why, but it seems the binary operators protocol implementation generates invalid data.