pylint-bot / test

0 stars 0 forks source link

Name lookup can lead to maximum recursion errors in certain situations #264

Open pylint-bot opened 8 years ago

pylint-bot commented 8 years ago

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


Given the following code, astroid will crash with a RuntimeError. The problem occurs because k is not inferred as the argument, but as the iterating element from the comprehension, which makes dict(**k) to be reevaluated at each inference step. This might be solved when we'll rewrite the lookup mechanism, since right now it's scattered all over the place.

#!python

from astroid.test_utils import extract_node
n = extract_node('''

def test(k):
   (k for k in __(dict(**k)))
''')
print(next(n.infer()))