For Python 3: add LOAD_CLASSDEREF op

This commit is contained in:
rocky
2016-06-20 13:04:21 -04:00
parent 8c374904f5
commit 80cfe62f36
3 changed files with 14 additions and 4 deletions

View File

@@ -344,6 +344,10 @@ class Python3Parser(PythonParser):
'''
expr ::= LOAD_CLASSNAME
expr ::= LOAD_ASSERT
# Python 3.4+
expr ::= LOAD_CLASSDEREF
# Python3 drops slice0..slice3
# Python 3.3+ adds yield from

View File

@@ -50,7 +50,8 @@ class Scanner2(scan.Scanner):
"""
show_asm = self.show_asm if not show_asm else show_asm
if self.show_asm in ('both', 'before'):
# show_asm = 'before'
if show_asm in ('both', 'before'):
from xdis.bytecode import Bytecode
bytecode = Bytecode(co, self.opc)
for instr in bytecode.get_instructions(co):

View File

@@ -344,6 +344,10 @@ TABLE_DIRECT = {
'kv2': ( '%c: %c', 1, 2 ),
'mapexpr': ( '{%[1]C}', (0, maxint, ', ') ),
# CE - Fixes for tuples
'assign2': ( '%|%c, %c = %c, %c\n', 3, 4, 0, 1 ),
'assign3': ( '%|%c, %c, %c = %c, %c, %c\n', 5, 6, 7, 0, 1, 2 ),
#######################
# Python 2.3 Additions
#######################
@@ -365,9 +369,10 @@ TABLE_DIRECT = {
'importmultiple': ( '%|import %c%c\n', 2, 3 ),
'import_cont' : ( ', %c', 2 ),
# CE - Fixes for tuples
'assign2': ( '%|%c, %c = %c, %c\n', 3, 4, 0, 1 ),
'assign3': ( '%|%c, %c, %c = %c, %c, %c\n', 5, 6, 7, 0, 1, 2 ),
########################
# Python 3.4+ Additions
#######################
'LOAD_CLASSDEREF': ( '%{pattr}', ),
}