look for "closure" node from the end...

Fix previous commit. Looking from the beginning fails because there are
a variable number of default values. From the end though seems fixed.
This commit is contained in:
rocky
2018-03-04 19:28:51 -05:00
parent 35fcb1edf1
commit def9e1676b

View File

@@ -504,7 +504,7 @@ def make_function3(self, node, is_lambda, nested=1, codeNode=None):
# FIXME: there is probably a better way to classify this.
if (self.version <= 3.3 and len(node) > 2 and
node[lambda_index] != 'LOAD_LAMBDA' and
(node[0].kind.startswith('kwarg') or node[2].kind != 'load_closure')):
(node[0].kind.startswith('kwarg') or node[-4].kind != 'load_closure')):
# args are after kwargs; kwargs are bundled as one node
defparams = node[1:args_node.attr[0]+1]
else: