3.7+ multiple imports of dotted path

This commit is contained in:
rocky
2020-01-03 23:22:28 -05:00
parent 077f192711
commit d5df411c7a
4 changed files with 7 additions and 4 deletions

View File

@@ -243,7 +243,6 @@ case $PYVERSION in
[test_dis.py]=1 # We change line numbers - duh!
[test_enumerate.py]=1 #
[test_enum.py]=1 #
[test_exceptions.py]=1 # works in decompile3; dotted import errors - Investigate
[test_faulthandler.py]=1 # takes too long
# ...
)
@@ -251,8 +250,9 @@ case $PYVERSION in
3.8)
SKIP_TESTS=(
[test_contains.py]=1 # Code "while False: yield None" is optimized away in compilation
[test_collections.py]=1 # Fixed I think in decompyle3 - pull from there
[test_collections.py]=1 # Investigate
[test_decorators.py]=1 # Control flow wrt "if elif"
[test_exceptions.py]=1 # parse error
[test_dis.py]=1 # We change line numbers - duh!
[test_pow.py]=1 # Control flow wrt "continue"
[test_quopri.py]=1 # Only fails on POWER

View File

@@ -62,6 +62,8 @@ class PythonParser(GenericASTBuilder):
'kvlist_n',
# Python 3.6+
'come_from_loops',
# Python 3.7+
'importlist37',
]
self.collect = frozenset(nt_list)

View File

@@ -346,7 +346,7 @@ class Python37Parser(Python37BaseParser):
attribute37 ::= expr LOAD_METHOD
stmt ::= import_from37
importlist37 ::= importlist37 alias
importlist37 ::= importlist37 alias37
importlist37 ::= alias37
alias37 ::= IMPORT_NAME store
alias37 ::= IMPORT_FROM store

View File

@@ -15,7 +15,7 @@
"""Isolate Python 3.7 version-specific semantic actions here.
"""
from uncompyle6.semantics.consts import PRECEDENCE, TABLE_DIRECT
from uncompyle6.semantics.consts import PRECEDENCE, TABLE_DIRECT, maxint
def customize_for_version37(self, version):
########################
@@ -135,6 +135,7 @@ def customize_for_version37(self, version):
(3, 'importlist37') ),
"importattr37": ("%c", (0, "IMPORT_NAME_ATTR")),
'importlist37': ("%C", (0, maxint, ', ') ),
'list_if37': ( " if %p%c", (0, 27), 1 ),
'list_if37_not': ( " if not %p%c", (0, 27), 1 ),
"testfalse_not_or": ("not %c or %c", (0, "expr"), (2, "expr")),