# HG changeset patch # User Sylvain Thénault <sylvain.thenault@logilab.fr> # Date 1255093894 -7200 # Fri Oct 09 15:11:34 2009 +0200 # Node ID 38cc25b76f4258ff40e3d03f28cab7600438c5fe # Parent e6639b4a6edde13213fd6d985906134cb640c445 don't crash on bad number of selected terms in subquery diff --git a/stcheck.py b/stcheck.py --- a/stcheck.py +++ b/stcheck.py @@ -187,7 +187,12 @@ # map subquery variable names to outer query variable names trmap = {} for i, vref in enumerate(node.aliases): - subvref = select.selection[i] + try: + subvref = select.selection[i] + except IndexError: + errors.append('subquery "%s" has only %s selected terms, needs %s' + % (select, len(select.selection), len(node.aliases))) + continue if isinstance(subvref, VariableRef): trmap[subvref.name] = vref.name elif (isinstance(subvref, Function) and subvref.descr().aggregat