diff --git a/test/bytecode_3.1_run/05_dict_comp.pyc b/test/bytecode_3.1_run/05_dict_comp.pyc index 17657f4a..644ed11a 100644 Binary files a/test/bytecode_3.1_run/05_dict_comp.pyc and b/test/bytecode_3.1_run/05_dict_comp.pyc differ diff --git a/test/bytecode_3.5_run/05_dict_comp.pyc b/test/bytecode_3.5_run/05_dict_comp.pyc index 4734945d..08c14060 100644 Binary files a/test/bytecode_3.5_run/05_dict_comp.pyc and b/test/bytecode_3.5_run/05_dict_comp.pyc differ diff --git a/test/simple_source/comprehension/05_dict_comp.py b/test/simple_source/comprehension/05_dict_comp.py index 12b103ee..bf21b795 100644 --- a/test/simple_source/comprehension/05_dict_comp.py +++ b/test/simple_source/comprehension/05_dict_comp.py @@ -3,12 +3,24 @@ # # This code is RUNNABLE! def x(s): - return {k: v - for (k, v) in s - if not k.startswith('_') - } + return {k: v for (k, v) in s if not k.startswith("_")} + # Yes, the print() is funny. This is # to test though a 2-arg assert where # the 2nd argument is not a string. -assert x((('_foo', None),)) == {}, print("See issue #162") +assert x((("_foo", None),)) == {}, print("See issue #162") + +# From 3.7 test_dictcomps.py +assert {k: v for k in range(10) for v in range(10) if k == v} == { + 0: 0, + 1: 1, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, +} diff --git a/test/stdlib/3.3-exclude.sh b/test/stdlib/3.3-exclude.sh index 617d58e5..06fc914e 100644 --- a/test/stdlib/3.3-exclude.sh +++ b/test/stdlib/3.3-exclude.sh @@ -5,7 +5,6 @@ SKIP_TESTS=( [test_concurrent_futures.py]=1 # too long? [test_decimal.py]=1 # test takes too long to run: 18 seconds [test_descr.py]=1 # test assertion errors - [test_dictcomps.py]=1 # test assertion errors [test_doctest.py]=1 # test assertion errors [test_doctest2.py]=1 # test assertion errors [test_dis.py]=1 # We change line numbers - duh! diff --git a/test/stdlib/3.4-exclude.sh b/test/stdlib/3.4-exclude.sh index 46819678..16297a24 100644 --- a/test/stdlib/3.4-exclude.sh +++ b/test/stdlib/3.4-exclude.sh @@ -21,7 +21,6 @@ SKIP_TESTS=( [test_decimal.py]=1 # test takes too long to run: 18 seconds [test_devpoll.py]=1 # it fails on its own [test_descr.py]=1 # Doesn't terminate - [test_dictcomps.py]=1 # test assertion failure [test_dict.py]=1 # [test_dis.py]=1 # We change line numbers - duh! [test_distutils.py]=1 # it fails on its own diff --git a/test/stdlib/3.5-exclude.sh b/test/stdlib/3.5-exclude.sh index 05147d78..e88b0e41 100644 --- a/test/stdlib/3.5-exclude.sh +++ b/test/stdlib/3.5-exclude.sh @@ -32,7 +32,6 @@ SKIP_TESTS=( [test_devpoll.py]=1 # it fails on its own [test_dict.py]=1 # - [test_dictcomps.py]=1 # test assertion failure [test_dis.py]=1 # We change line numbers - duh! [test_distutils.py]=1 # it fails on its own [test_dbm_gnu.py]=1 # Doesn't terminate diff --git a/test/stdlib/3.6-exclude.sh b/test/stdlib/3.6-exclude.sh index ccd67776..0d041593 100644 --- a/test/stdlib/3.6-exclude.sh +++ b/test/stdlib/3.6-exclude.sh @@ -51,7 +51,6 @@ SKIP_TESTS=( [test_descr.py]=1 # syntax error: Investigate [test_devpoll.py]=1 # it fails on its own [test_dict.py]=1 # it fails on its own - [test_dictcomps.py]=1 # We change line numbers - duh! [test_dis.py]=1 # We change line numbers - duh! [test_doctest2.py]=1 # [test_doctest.py]=1 # diff --git a/test/stdlib/3.7-exclude.sh b/test/stdlib/3.7-exclude.sh index 7581cdb7..16eaaaee 100644 --- a/test/stdlib/3.7-exclude.sh +++ b/test/stdlib/3.7-exclude.sh @@ -31,7 +31,6 @@ SKIP_TESTS=( [test_decimal.py]=1 # Parse error [test_descr.py]=1 # Parse error [test_devpoll.py]=1 # it fails on its own - [test_dictcomps.py]=1 # Bad semantics - Investigate [test_dis.py]=1 # We change line numbers - duh! [test_doctest2.py]=1 # assert failure [test_docxmlrpc.py]=1 diff --git a/test/stdlib/runtests.sh b/test/stdlib/runtests.sh index 5a44a046..a0b26ca1 100755 --- a/test/stdlib/runtests.sh +++ b/test/stdlib/runtests.sh @@ -274,7 +274,7 @@ fi PYENV_ROOT=${PYENV_ROOT:-$HOME/.pyenv} pyenv_local=$(pyenv local) -# pyenv version cleaning +# pyenv version update for dir in ../ ../../ ; do cp -v .python-version $dir done diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index aac4a9bd..54b243c7 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -1333,7 +1333,7 @@ class SourceWalker(GenericASTTraversal, object): if comp_store: self.preorder(comp_for) - elif if_node: + if if_node: self.write(" if ") if have_not: self.write("not ")