From 3d277270a428a73466a40db602d3cd9334a9fa69 Mon Sep 17 00:00:00 2001 From: rocky Date: Wed, 6 Dec 2017 20:21:00 -0500 Subject: [PATCH] Partial fix for removing singleton expr reduction --- uncompyle6/semantics/pysource.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 6b694f48..e040b310 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -661,9 +661,8 @@ class SourceWalker(GenericASTTraversal, object): def is_return_none(self, node): # Is there a better way? ret = (node[0] == 'ret_expr' - and node[0][0] == 'expr' - and node[0][0][0] == 'LOAD_CONST' - and node[0][0][0].pattr is None) + and node[0][0]== 'LOAD_CONST' + and node[0][0].pattr is None) if self.version <= 2.6: return ret else: @@ -2329,10 +2328,10 @@ class SourceWalker(GenericASTTraversal, object): # than fight (with the grammar to not emit "return None"). if self.hide_internal: if len(tokens) >= 2 and not noneInNames: - if tokens[-1].kind in ('RETURN_VALUE', 'RETURN_VALUE_LAMBDA'): + if tokens[-1] in ('RETURN_VALUE', 'RETURN_VALUE_LAMBDA'): # Python 3.4's classes can add a "return None" which is # invalid syntax. - if tokens[-2].kind == 'LOAD_CONST': + if tokens[-2] == 'LOAD_CONST': if isTopLevel or tokens[-2].pattr is None: del tokens[-2:] else: