logilab-astng #127416 pylint crashes when tuple not returned when expected [validation pending]

If methodA is expected to return a tuple and is unpacked, but methodA does not return a tuple, then pylint crashes.

Below is the example code that can cause pylint to crash:

"""
FUNCTIONALITY
"""


class Example():
  """
      @summary: Demonstrates pylint error caused by method expecting tuple
      but called method does not return tuple
  """

  def __init__(self):
      pass

  def method_expects_tuple(self, obj):
      m, args = self.method_doesnot_return_tuple(obj)
      result = m(args)
      return result


  def method_doesnot_return_tuple(self, obj):
      # we want to lock what we have in the inventory, not what is to have
      # in the future
      return {'success': ''}

The stack trace that is seen when pylint is run is:

$ pylint crash.py
No config file found, using default configuration
************* Module crash
C: 15,4:Example.method_expects_tuple: Missing docstring
C: 16,8:Example.method_expects_tuple: Invalid name "m" for type variable  (should match [a-z_][a-z0-9_]{2,30}$)
Traceback (most recent call last):
 File "/usr/bin/pylint", line 8, in <module>
   load_entry_point('pylint==0.27.0', 'console_scripts', 'pylint')()
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/__init__.py", line 21, in run_pylint
   Run(sys.argv[1:])
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/lint.py", line 991, in __init__
   linter.check(args)
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/lint.py", line 587, in check
   self.check_astng_module(astng, walker, rawcheckers)
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/lint.py", line 666, in check_astng_module
   walker.walk(astng)
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/utils.py", line 600, in walk
   self.walk(child)
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/utils.py", line 600, in walk
   self.walk(child)
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/utils.py", line 600, in walk
   self.walk(child)
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/utils.py", line 597, in walk
   cb(astng)
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/checkers/typecheck.py", line 222, in visit_assign
   function_node = safe_infer(node.value.func)
 File "/usr/lib/python2.6/site-packages/pylint-0.27.0-py2.6.egg/pylint/checkers/utils.py", line 79, in safe_infer
   value = inferit.next()
 File "/usr/lib/python2.6/site-packages/logilab_astng-0.24.2-py2.6.egg/logilab/astng/bases.py", line 304, in wrapped
   for res in _func(node, context, **kwargs):
 File "/usr/lib/python2.6/site-packages/logilab_astng-0.24.2-py2.6.egg/logilab/astng/bases.py", line 115, in _infer_stmts
   for infered in stmt.infer(context):
 File "/usr/lib/python2.6/site-packages/logilab_astng-0.24.2-py2.6.egg/logilab/astng/bases.py", line 304, in wrapped
   for res in _func(node, context, **kwargs):
 File "/usr/lib/python2.6/site-packages/logilab_astng-0.24.2-py2.6.egg/logilab/astng/inference.py", line 352, in infer_ass
   stmts = list(self.assigned_stmts(context=context))
 File "/usr/lib/python2.6/site-packages/logilab_astng-0.24.2-py2.6.egg/logilab/astng/bases.py", line 328, in wrapper
   for node in func(*args, **kwargs):
 File "/usr/lib/python2.6/site-packages/logilab_astng-0.24.2-py2.6.egg/logilab/astng/protocols.py", line 270, in assign_assigned_stmts
   for infered in _resolve_asspart(self.value.infer(context), asspath, context):
 File "/usr/lib/python2.6/site-packages/logilab_astng-0.24.2-py2.6.egg/logilab/astng/protocols.py", line 283, in _resolve_asspart
   assigned = part.getitem(index, context)
 File "/usr/lib/python2.6/site-packages/logilab_astng-0.24.2-py2.6.egg/logilab/astng/node_classes.py", line 518, in getitem
   for inferedkey in self.items[i].infer(context):
AttributeError: 'tuple' object has no attribute 'infer'
prioritynormal
typebug
done in0.24.3
load left0.000
closed by<not specified>