diff --git a/__pkginfo__.py b/__pkginfo__.py index 7edfb3dc..70245841 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -37,7 +37,7 @@ entry_points={ ]} ftp_url = None install_requires = ['spark-parser >= 1.4.0', - 'xdis >= 1.1.5'] + 'xdis >= 1.1.6'] license = 'MIT' mailing_list = 'python-debugger@googlegroups.com' modname = 'uncompyle6' diff --git a/uncompyle6/parsers/parse24.py b/uncompyle6/parsers/parse24.py index a4acb1f5..ed6ccd4e 100644 --- a/uncompyle6/parsers/parse24.py +++ b/uncompyle6/parsers/parse24.py @@ -15,8 +15,18 @@ class Python24Parser(Python25Parser): def p_misc24(self, args): ''' # 2.5+ has two LOAD_CONSTs, one for the number '.'s in a relative import - importstmt ::= LOAD_CONST filler import_as - importfrom ::= LOAD_CONST filler IMPORT_NAME importlist2 POP_TOP + # keep positions similar to simplify semantic actions + + importstmt ::= filler LOAD_CONST import_as + importfrom ::= filler LOAD_CONST IMPORT_NAME importlist2 POP_TOP + + importmultiple ::= filler LOAD_CONST import_as imports_cont + import_cont ::= filler LOAD_CONST import_as_cont + + # Python 2.5+ omits POP_TOP POP_BLOCK + while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_TOP POP_BLOCK COME_FROM + + call_stmt ::= yield ''' class Python24ParserSingle(Python25Parser, PythonParserSingle): diff --git a/uncompyle6/scanners/scanner2.py b/uncompyle6/scanners/scanner2.py index f94a5c38..8a844d45 100755 --- a/uncompyle6/scanners/scanner2.py +++ b/uncompyle6/scanners/scanner2.py @@ -330,9 +330,12 @@ class Scanner2(scan.Scanner): j = self.prev[s] while code[j] == self.opc.JA: j = self.prev[j] - if code[j] == self.opc.LIST_APPEND: # list comprehension - stmts.remove(s) - continue + try: + if code[j] == self.opc.LIST_APPEND: # list comprehension + stmts.remove(s) + continue + except: + from trepan.api import debug; debug() elif code[s] == self.opc.POP_TOP and code[self.prev[s]] == self.opc.ROT_TWO: stmts.remove(s) continue