diff --git a/uncompyle6/semantics/make_function36.py b/uncompyle6/semantics/make_function36.py index 1509019d..4c29a936 100644 --- a/uncompyle6/semantics/make_function36.py +++ b/uncompyle6/semantics/make_function36.py @@ -31,7 +31,6 @@ from uncompyle6.semantics.helper import ( find_globals_and_nonlocals, find_none, ) -from itertools import zip_longest from uncompyle6.show import maybe_show_tree_param_default @@ -249,7 +248,9 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): self.write(", ") ends_in_comma = True - ann_dict = kw_dict = default_tup = None + # ann_dict = kw_dict = default_tup = None + kw_dict = None + fn_bits = node[-1].attr # Skip over: # MAKE_FUNCTION, diff --git a/uncompyle6/semantics/n_actions.py b/uncompyle6/semantics/n_actions.py index 50b4771a..f5ab142d 100644 --- a/uncompyle6/semantics/n_actions.py +++ b/uncompyle6/semantics/n_actions.py @@ -233,7 +233,10 @@ class NonterminalActions: assert len(keys) == len(flat_elems) - 1 for i, elem in enumerate(flat_elems[:-1]): assert elem.kind == "ADD_VALUE" - value = elem.pattr + try: + value = "%r" % elem.pattr + except Exception: + value = elem.pattr if elem.linestart is not None: if elem.linestart != self.line_number: next_indent = self.indent + INDENT_PER_LEVEL[:-1] @@ -255,7 +258,10 @@ class NonterminalActions: else: for elem in flat_elems: assert elem.kind == "ADD_VALUE" - value = elem.pattr + try: + value = "%r" % elem.pattr + except Exception: + value = elem.pattr if elem.linestart is not None: if elem.linestart != self.line_number: next_indent = self.indent + INDENT_PER_LEVEL[:-1]