diff --git a/README.rst b/README.rst index 033b2f55..7c03a9d5 100644 --- a/README.rst +++ b/README.rst @@ -84,17 +84,14 @@ for usage help. Known Bugs/Restrictions ----------------------- -Python 2 deparsing decompiles each and all the Python 2.3 to 2.7.10 -installed packages I have on my system. Later distributions average -about 200 files. +Python 2 deparsing decompiles and verifies each and all the Python 2.6.9 +to 2.7.11 installed packages I have on my system. Later distributions +average about 200 files. At this point, 2.7 decompilation is +better than uncompyle2. A number of bugs have been fixed. -More than 90% of the 2.7 files verify ok Some of these failures may be -bugs in the verification process. At this point, 2.7 decompilation is -better than uncompyle2. A number of bugs have been fixed over what was -in uncompyle2. - -That said, I'd like the decompilation process still feels a little bit -hacky in certain places and we still get parse errors too often. +For Python 3.4.2 bytecode, there is one verification error that needs +addressing. There are still a couple of parse errors on 2.3.7 and +2.4.6. Removing 3.5 verification errors still remains. There are a few constructs that still need to be added to Python 3.5. Python 3.6 changes things drastically by using word codes rather than diff --git a/test/bytecode_3.4/06_list_ifnot.pyc b/test/bytecode_3.4/06_list_ifnot.pyc new file mode 100644 index 00000000..0d524661 Binary files /dev/null and b/test/bytecode_3.4/06_list_ifnot.pyc differ diff --git a/test/bytecode_3.5/06_list_ifnot.pyc b/test/bytecode_3.5/06_list_ifnot.pyc index 8ca0449e..e0c41b19 100644 Binary files a/test/bytecode_3.5/06_list_ifnot.pyc and b/test/bytecode_3.5/06_list_ifnot.pyc differ diff --git a/uncompyle6/semantics/fragments.py b/uncompyle6/semantics/fragments.py index 9059a1e4..8fb2e441 100644 --- a/uncompyle6/semantics/fragments.py +++ b/uncompyle6/semantics/fragments.py @@ -669,6 +669,7 @@ class FragmentsWalker(pysource.SourceWalker, object): comp_for = n comp_designator = ast[3] + have_not = False while n in ('list_iter', 'comp_iter'): n = n[0] # recurse one step if n == 'list_for': @@ -676,6 +677,7 @@ class FragmentsWalker(pysource.SourceWalker, object): designator = n[2] n = n[3] elif n in ['list_if', 'list_if_not', 'comp_if']: + have_not = n in ('list_if_not', 'comp_ifnot') if_node = n[0] if n[1] == 'designator': designator = n[1] @@ -707,6 +709,8 @@ class FragmentsWalker(pysource.SourceWalker, object): self.preorder(comp_for) elif if_node: self.write(' if ') + if have_not: + self.write('not ') self.preorder(if_node) self.prec = p self.name = old_name diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 402d7d26..73968697 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -1171,13 +1171,15 @@ class SourceWalker(GenericASTTraversal, object): comp_for = n comp_designator = ast[3] + have_not = False while n in ('list_iter', 'comp_iter'): n = n[0] # recurse one step if n in ('list_for', 'comp_for'): if n[2] == 'designator': designator = n[2] n = n[3] - elif n in ('list_if', 'list_if_not', 'comp_if'): + elif n in ('list_if', 'list_if_not', 'comp_if', 'comp_ifnot'): + have_not = n in ('list_if_not', 'comp_ifnot') if_node = n[0] if n[1] == 'designator': designator = n[1] @@ -1203,6 +1205,8 @@ class SourceWalker(GenericASTTraversal, object): self.preorder(comp_for) elif if_node: self.write(' if ') + if have_not: + self.write('not ') self.preorder(if_node) self.prec = p