You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Correct handling "if" in dictcomp in semantic actions for 3.x
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -3,12 +3,24 @@
|
|||||||
#
|
#
|
||||||
# This code is RUNNABLE!
|
# This code is RUNNABLE!
|
||||||
def x(s):
|
def x(s):
|
||||||
return {k: v
|
return {k: v for (k, v) in s if not k.startswith("_")}
|
||||||
for (k, v) in s
|
|
||||||
if not k.startswith('_')
|
|
||||||
}
|
|
||||||
|
|
||||||
# Yes, the print() is funny. This is
|
# Yes, the print() is funny. This is
|
||||||
# to test though a 2-arg assert where
|
# to test though a 2-arg assert where
|
||||||
# the 2nd argument is not a string.
|
# 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,
|
||||||
|
}
|
||||||
|
@@ -5,7 +5,6 @@ SKIP_TESTS=(
|
|||||||
[test_concurrent_futures.py]=1 # too long?
|
[test_concurrent_futures.py]=1 # too long?
|
||||||
[test_decimal.py]=1 # test takes too long to run: 18 seconds
|
[test_decimal.py]=1 # test takes too long to run: 18 seconds
|
||||||
[test_descr.py]=1 # test assertion errors
|
[test_descr.py]=1 # test assertion errors
|
||||||
[test_dictcomps.py]=1 # test assertion errors
|
|
||||||
[test_doctest.py]=1 # test assertion errors
|
[test_doctest.py]=1 # test assertion errors
|
||||||
[test_doctest2.py]=1 # test assertion errors
|
[test_doctest2.py]=1 # test assertion errors
|
||||||
[test_dis.py]=1 # We change line numbers - duh!
|
[test_dis.py]=1 # We change line numbers - duh!
|
||||||
|
@@ -21,7 +21,6 @@ SKIP_TESTS=(
|
|||||||
[test_decimal.py]=1 # test takes too long to run: 18 seconds
|
[test_decimal.py]=1 # test takes too long to run: 18 seconds
|
||||||
[test_devpoll.py]=1 # it fails on its own
|
[test_devpoll.py]=1 # it fails on its own
|
||||||
[test_descr.py]=1 # Doesn't terminate
|
[test_descr.py]=1 # Doesn't terminate
|
||||||
[test_dictcomps.py]=1 # test assertion failure
|
|
||||||
[test_dict.py]=1 #
|
[test_dict.py]=1 #
|
||||||
[test_dis.py]=1 # We change line numbers - duh!
|
[test_dis.py]=1 # We change line numbers - duh!
|
||||||
[test_distutils.py]=1 # it fails on its own
|
[test_distutils.py]=1 # it fails on its own
|
||||||
|
@@ -32,7 +32,6 @@ SKIP_TESTS=(
|
|||||||
|
|
||||||
[test_devpoll.py]=1 # it fails on its own
|
[test_devpoll.py]=1 # it fails on its own
|
||||||
[test_dict.py]=1 #
|
[test_dict.py]=1 #
|
||||||
[test_dictcomps.py]=1 # test assertion failure
|
|
||||||
[test_dis.py]=1 # We change line numbers - duh!
|
[test_dis.py]=1 # We change line numbers - duh!
|
||||||
[test_distutils.py]=1 # it fails on its own
|
[test_distutils.py]=1 # it fails on its own
|
||||||
[test_dbm_gnu.py]=1 # Doesn't terminate
|
[test_dbm_gnu.py]=1 # Doesn't terminate
|
||||||
|
@@ -51,7 +51,6 @@ SKIP_TESTS=(
|
|||||||
[test_descr.py]=1 # syntax error: Investigate
|
[test_descr.py]=1 # syntax error: Investigate
|
||||||
[test_devpoll.py]=1 # it fails on its own
|
[test_devpoll.py]=1 # it fails on its own
|
||||||
[test_dict.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_dis.py]=1 # We change line numbers - duh!
|
||||||
[test_doctest2.py]=1 #
|
[test_doctest2.py]=1 #
|
||||||
[test_doctest.py]=1 #
|
[test_doctest.py]=1 #
|
||||||
|
@@ -31,7 +31,6 @@ SKIP_TESTS=(
|
|||||||
[test_decimal.py]=1 # Parse error
|
[test_decimal.py]=1 # Parse error
|
||||||
[test_descr.py]=1 # Parse error
|
[test_descr.py]=1 # Parse error
|
||||||
[test_devpoll.py]=1 # it fails on its own
|
[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_dis.py]=1 # We change line numbers - duh!
|
||||||
[test_doctest2.py]=1 # assert failure
|
[test_doctest2.py]=1 # assert failure
|
||||||
[test_docxmlrpc.py]=1
|
[test_docxmlrpc.py]=1
|
||||||
|
@@ -274,7 +274,7 @@ fi
|
|||||||
PYENV_ROOT=${PYENV_ROOT:-$HOME/.pyenv}
|
PYENV_ROOT=${PYENV_ROOT:-$HOME/.pyenv}
|
||||||
pyenv_local=$(pyenv local)
|
pyenv_local=$(pyenv local)
|
||||||
|
|
||||||
# pyenv version cleaning
|
# pyenv version update
|
||||||
for dir in ../ ../../ ; do
|
for dir in ../ ../../ ; do
|
||||||
cp -v .python-version $dir
|
cp -v .python-version $dir
|
||||||
done
|
done
|
||||||
|
@@ -1333,7 +1333,7 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
|
|
||||||
if comp_store:
|
if comp_store:
|
||||||
self.preorder(comp_for)
|
self.preorder(comp_for)
|
||||||
elif if_node:
|
if if_node:
|
||||||
self.write(" if ")
|
self.write(" if ")
|
||||||
if have_not:
|
if have_not:
|
||||||
self.write("not ")
|
self.write("not ")
|
||||||
|
Reference in New Issue
Block a user