From 2b8406e7a819155e2c5df826ca39b19e21dcb2c0 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 25 Feb 2024 06:08:06 -0500 Subject: [PATCH] mark "psuedo ops" --- uncompyle6/scanners/scanner3.py | 6 +++--- uncompyle6/scanners/scanner37.py | 2 +- uncompyle6/semantics/pysource.py | 2 +- uncompyle6/semantics/transform.py | 16 +++------------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/uncompyle6/scanners/scanner3.py b/uncompyle6/scanners/scanner3.py index 3c51c3e6..634417af 100644 --- a/uncompyle6/scanners/scanner3.py +++ b/uncompyle6/scanners/scanner3.py @@ -266,7 +266,7 @@ class Scanner3(Scanner): has_arg=True, has_extended_arg=False, opc=self.opc, - optype=None, + optype="pseudo", ) ) for j in range(collection_start, i): @@ -293,7 +293,7 @@ class Scanner3(Scanner): has_arg=t.has_arg, has_extended_arg=False, opc=t.opc, - optype=None, + optype="pseudo", ) ) return new_tokens @@ -342,7 +342,7 @@ class Scanner3(Scanner): has_arg=True, has_extended_arg=False, opc=self.opc, - optype=None, + optype="pseudo", ) ) for j in range(collection_start, i, 2): diff --git a/uncompyle6/scanners/scanner37.py b/uncompyle6/scanners/scanner37.py index ea6db8ac..894da02c 100644 --- a/uncompyle6/scanners/scanner37.py +++ b/uncompyle6/scanners/scanner37.py @@ -90,7 +90,7 @@ class Scanner37(Scanner37Base): has_arg=True, has_extended_arg=False, opc=self.opc, - optype=None, + optype="pseudo", ) ) for j in range(collection_start, i): diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 31dc542a..c351337e 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -1267,7 +1267,7 @@ class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin): transform_tree = self.treeTransform.transform(ast, code) - self.maybe_show_tree(ast, phase="before") + self.maybe_show_tree(transform_tree, phase="after") del ast # Save memory return transform_tree diff --git a/uncompyle6/semantics/transform.py b/uncompyle6/semantics/transform.py index 430f1e0f..fee594ba 100644 --- a/uncompyle6/semantics/transform.py +++ b/uncompyle6/semantics/transform.py @@ -489,19 +489,9 @@ class TreeTransform(GenericASTTraversal, object): self.ast[i] = self.ast[i][0] if is_docstring(self.ast[i], self.version, code.co_consts): - load_const = self.ast[i].first_child() - docstring_ast = SyntaxTree( - "docstring", - [ - Token( - "LOAD_STR", - has_arg=True, - offset=0, - attr=load_const.attr, - pattr=load_const.pattr, - ) - ], - ) + load_const = copy(self.ast[i].first_child()) + store_name = copy(self.ast[i].last_child()) + docstring_ast = SyntaxTree("docstring", [load_const, store_name]) docstring_ast.transformed_by = "transform" del self.ast[i] self.ast.insert(0, docstring_ast)