From e4e3743de5116bd9e5f04b65fb59dfeae7d8ea78 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 28 Nov 2024 08:03:32 -0500 Subject: [PATCH] Tweak when we delete LOAD_CONST RETURN_VALUE --- uncompyle6/semantics/pysource.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 78fd4e8c..5fb77771 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -1212,6 +1212,7 @@ class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin): is_lambda=False, noneInNames=False, is_top_level_module=False, + compile_mode="exec", ) -> GenericASTTraversal: # FIXME: DRY with fragments.py @@ -1262,7 +1263,6 @@ class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin): load_const.kind == "LOAD_CONST" and load_const.linestart is None and load_const.attr is None - or is_top_level_module ): # Delete LOAD_CONST (None) RETURN_VALUE del tokens[-2:] @@ -1371,6 +1371,7 @@ def code_deparse( co, is_lambda=is_lambda_mode(compile_mode), is_top_level_module=is_top_level_module, + compile_mode=compile_mode, ) # XXX workaround for profiling