diff --git a/uncompyle6/semantics/make_function36.py b/uncompyle6/semantics/make_function36.py index 4c29a936..0546e756 100644 --- a/uncompyle6/semantics/make_function36.py +++ b/uncompyle6/semantics/make_function36.py @@ -39,11 +39,12 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): """Dump function definition, doc string, and function body in Python version 3.6 and above. """ + # MAKE_CLOSURE adds an additional closure slot # In Python 3.6 and above stack change again. I understand # 3.7 changes some of those changes, although I don't - # see it in this code yet. Yes, it is hard to follow + # see it in this code yet. Yes, it is hard to follow, # and I am sure I haven't been able to keep up. # Thank you, Python. @@ -85,16 +86,15 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): args_attr = args_node.attr if len(args_attr) == 3: - pos_args, kw_args, annotate_argc = args_attr + _, kw_args, annotate_argc = args_attr else: - pos_args, kw_args, annotate_argc, closure = args_attr + _, kw_args, annotate_argc, closure = args_attr if node[-2] != "docstring": i = -4 else: i = -5 - kw_pairs = 0 if annotate_argc: # Turn into subroutine and DRY with other use annotate_node = node[i] @@ -106,9 +106,9 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): ): types = [self.traverse(n, indent="") for n in annotate_node[:-2]] names = annotate_node[-2].attr - l = len(types) - assert l == len(names) - for i in range(l): + length = len(types) + assert length == len(names) + for i in range(length): annotate_dict[names[i]] = types[i] pass pass @@ -119,11 +119,6 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): # annotate = node[i] i -= 1 - if kw_args: - kw_node = node[pos_args] - if kw_node == "expr": - kw_node = kw_node[0] - defparams = [] # FIXME: DRY with code below default, kw_args, annotate_argc = args_node.attr[0:3] @@ -181,9 +176,7 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): if defparams: for i, defparam in enumerate(defparams): params.append( - build_param( - ast, paramnames[i], defparam, annotate_dict.get(paramnames[i]) - ) + build_param(paramnames[i], defparam, annotate_dict.get(paramnames[i])) ) for param in paramnames[i + 1 :]: @@ -236,7 +229,7 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): ends_in_comma = False if kwonlyargcount > 0: - if not (4 & code.co_flags): + if not 4 & code.co_flags: if argc > 0: self.write(", *, ") else: @@ -300,7 +293,7 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): pass pass # handle others - other_kw = [c == None for c in kw_args] + other_kw = [c is None for c in kw_args] for i, flag in enumerate(other_kw): if flag: