Correct SET_LINENO handling in Python 2.2

Add more  2.2 tests
This commit is contained in:
rocky
2016-08-13 20:25:19 -04:00
parent d8598f61e4
commit 7ccbd419c6
7 changed files with 39 additions and 3 deletions

View File

@@ -13,7 +13,6 @@ class Python22Parser(Python23Parser):
def p_misc22(self, args):
'''
stmt ::= SET_LINENO
_for ::= LOAD_CONST FOR_LOOP
'''

View File

@@ -8,6 +8,7 @@ information for later use in deparsing.
"""
import uncompyle6.scanners.scanner23 as scan
# from uncompyle6.scanners.scanner26 import disassemble as disassemble26
# bytecode verification, verify(), uses JUMP_OPs from here
from xdis.opcodes import opcode_22
@@ -24,4 +25,11 @@ class Scanner22(scan.Scanner23):
self.opname = opcode_22.opname
self.version = 2.2
self.genexpr_name = '<generator expression>';
self.parent_injest = self.disassemble
self.disassemble = self.disassemble22
return
def disassemble22(self, co, classname=None, code_objects={}, show_asm=None):
tokens, customize = self.parent_injest(co, classname, code_objects, show_asm)
tokens = [t for t in tokens if t.type != 'SET_LINENO']
return tokens, customize