From f8bfde4a8ee05350ae23c82766567f8e64e5ae97 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 24 Aug 2019 07:47:48 -0400 Subject: [PATCH] Get ready for release 3.4.0 --- NEWS.md | 19 +++++++++++++++++++ test/simple_source/bug26/00_generator.py | 7 ------- uncompyle6/parsers/parse26.py | 3 --- uncompyle6/parsers/parse27.py | 5 +---- uncompyle6/version.py | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) delete mode 100644 test/simple_source/bug26/00_generator.py diff --git a/NEWS.md b/NEWS.md index 129b3039..4d3382c0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,22 @@ +3.4.0 2019-08-24 Totoro +======================= + +The main change is to add a tree-transformation phase. This simplifies the +code a little and allows us to turn `if ...: raise AssertionError` into +`assert`, and many `if ..: else if ...` into `if ... elif ..` + +Use options `--show=before` and `--show=after` to see the before the tree transformation phase and after the tree transformation phase. + +Most of the heavy lifting for this was done by x0ret. + +Other changes: + +- Fix issue #275, #283 (process to fix this bug is documented on wiki), #284 +- blacken more code +- CircleCI adjustments for a changing CircleCi +- Require more recent `xdis` for Python 3.8 +- Fix bugs in code using `BUILD_LIST_UNPACK` and variants + 3.3.5 2019-07-03 Pre Independence Day ===================================== diff --git a/test/simple_source/bug26/00_generator.py b/test/simple_source/bug26/00_generator.py deleted file mode 100644 index 12a4cfad..00000000 --- a/test/simple_source/bug26/00_generator.py +++ /dev/null @@ -1,7 +0,0 @@ -# Issue #283 in Python 2.6 -# See https://github.com/rocky/python-uncompyle6/issues/283 - -# This code is RUNNABLE! - -G = ( c for c in "spam, Spam, SPAM!" if c > 'A' and c < 'S') -assert list(G) == ["P", "M"] diff --git a/uncompyle6/parsers/parse26.py b/uncompyle6/parsers/parse26.py index 33012d0d..7d6ea006 100644 --- a/uncompyle6/parsers/parse26.py +++ b/uncompyle6/parsers/parse26.py @@ -250,9 +250,6 @@ class Python26Parser(Python2Parser): genexpr_func ::= setup_loop_lf FOR_ITER store comp_iter JUMP_ABSOLUTE come_froms POP_TOP jb_pop jb_pb_come_from - genexpr_func ::= setup_loop_lf FOR_ITER store comp_iter JUMP_BACK come_froms - POP_TOP jb_pb_come_from - generator_exp ::= LOAD_GENEXPR MAKE_FUNCTION_0 expr GET_ITER CALL_FUNCTION_1 COME_FROM list_if ::= list_if ::= expr jmp_false_then list_iter ''' diff --git a/uncompyle6/parsers/parse27.py b/uncompyle6/parsers/parse27.py index 6e456422..9bc8bf51 100644 --- a/uncompyle6/parsers/parse27.py +++ b/uncompyle6/parsers/parse27.py @@ -234,7 +234,7 @@ class Python27Parser(Python2Parser): return invalid if rule == ('and', ('expr', 'jmp_false', 'expr', '\\e_come_from_opt')): - # If the instruction after the instructions forming "and" is a "YIELD_VALUE" + # If the instruction after the instructions formin "and" is an "YIELD_VALUE" # then this is probably an "if" inside a comprehension. if tokens[last] == 'YIELD_VALUE': # Note: We might also consider testing last+1 being "POP_TOP" @@ -243,9 +243,6 @@ class Python27Parser(Python2Parser): # Test that jmp_false jumps to the end of "and" # or that it jumps to the same place as the end of "and" jmp_false = ast[1][0] - - # FIXME: if the jmp_false is POP_JUMP_IF_FALSE is the address - # is *absoulte* and the calulation below is wrong! jmp_target = jmp_false.offset + jmp_false.attr + 3 return not (jmp_target == tokens[last].offset or tokens[last].pattr == jmp_false.pattr) diff --git a/uncompyle6/version.py b/uncompyle6/version.py index 2cb6e9f8..5e196262 100644 --- a/uncompyle6/version.py +++ b/uncompyle6/version.py @@ -12,4 +12,4 @@ # along with this program. If not, see . # This file is suitable for sourcing inside bash as # well as importing into Python -VERSION="3.3.5" # noqa +VERSION="3.4.0" # noqa