pylint-bot/astroid-unofficial

List multiplication results in weird results when inferring

Opened this issue · 0 comments

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.