diff --git a/test/simple_source/def/01_class.py b/test/simple_source/def/01_class.py new file mode 100644 index 00000000..79a7eda2 --- /dev/null +++ b/test/simple_source/def/01_class.py @@ -0,0 +1,2 @@ +class A: + pass diff --git a/test/simple_source/def/10_class.py b/test/simple_source/def/10_class.py new file mode 100644 index 00000000..af9983c3 --- /dev/null +++ b/test/simple_source/def/10_class.py @@ -0,0 +1,33 @@ +class A: + + class A1: + def __init__(self): + self.a1 = True + + def foo(self): + self.b = True + + def __init__(self): + self.a = True + + def foo(self): + self.fooed = True + + +class B: + def __init__(self): + self.bed = True + + def bar(self): + self.barred = True + + +class C(A,B): + def foobar(self): + self.foobared = True + + +c = C() +c.foo() +c.bar() +c.foobar() diff --git a/uncompyle6/opcodes/opcode_32.py b/uncompyle6/opcodes/opcode_32.py index 238877b5..879e815c 100644 --- a/uncompyle6/opcodes/opcode_32.py +++ b/uncompyle6/opcodes/opcode_32.py @@ -92,6 +92,12 @@ def_op('STORE_LOCALS', 69) def_op('PRINT_EXPR', 70) def_op('LOAD_BUILD_CLASS', 71) +# Python3 drops/changes: +# def_op('PRINT_ITEM', 71) +# def_op('PRINT_NEWLINE', 72) +# def_op('PRINT_ITEM_TO', 73) +# def_op('PRINT_NEWLINE_TO', 74) + def_op('INPLACE_LSHIFT', 75) def_op('INPLACE_RSHIFT', 76) def_op('INPLACE_AND', 77) diff --git a/uncompyle6/opcodes/opcode_34.py b/uncompyle6/opcodes/opcode_34.py index be57b5fa..c9b9b472 100644 --- a/uncompyle6/opcodes/opcode_34.py +++ b/uncompyle6/opcodes/opcode_34.py @@ -100,13 +100,19 @@ def_op('BINARY_OR', 66) def_op('INPLACE_POWER', 67) def_op('GET_ITER', 68) -## FIXME: no code generates this +# FIXME: no code generates this def_op('STORE_LOCALS', 69) def_op('PRINT_EXPR', 70) def_op('LOAD_BUILD_CLASS', 71) def_op('YIELD_FROM', 72) +# Python3 drops/changes: +# def_op('PRINT_ITEM', 71) +# def_op('PRINT_NEWLINE', 72) +# def_op('PRINT_ITEM_TO', 73) +# def_op('PRINT_NEWLINE_TO', 74) + def_op('INPLACE_LSHIFT', 75) def_op('INPLACE_RSHIFT', 76) def_op('INPLACE_AND', 77) diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index a1843ce4..bcd24432 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -164,34 +164,35 @@ class Python3Parser(PythonParser): assign3 ::= expr expr expr ROT_THREE ROT_TWO designator designator designator ''' - def p_print(self, args): - ''' - stmt ::= print_items_stmt - stmt ::= print_nl - stmt ::= print_items_nl_stmt + # Python3 doesn't have a built-in print. + # def p_print(self, args): + # ''' + # stmt ::= print_items_stmt + # stmt ::= print_nl + # stmt ::= print_items_nl_stmt - print_items_stmt ::= expr PRINT_ITEM print_items_opt - print_items_nl_stmt ::= expr PRINT_ITEM print_items_opt PRINT_NEWLINE_CONT - print_items_opt ::= print_items - print_items_opt ::= - print_items ::= print_items print_item - print_items ::= print_item - print_item ::= expr PRINT_ITEM_CONT - print_nl ::= PRINT_NEWLINE - ''' + # print_items_stmt ::= expr PRINT_ITEM print_items_opt + # print_items_nl_stmt ::= expr PRINT_ITEM print_items_opt PRINT_NEWLINE_CONT + # print_items_opt ::= print_items + # print_items_opt ::= + # print_items ::= print_items print_item + # print_items ::= print_item + # print_item ::= expr PRINT_ITEM_CONT + # print_nl ::= PRINT_NEWLINE + # ''' - def p_print_to(self, args): - ''' - stmt ::= print_to - stmt ::= print_to_nl - stmt ::= print_nl_to - print_to ::= expr print_to_items POP_TOP - print_to_nl ::= expr print_to_items PRINT_NEWLINE_TO - print_nl_to ::= expr PRINT_NEWLINE_TO - print_to_items ::= print_to_items print_to_item - print_to_items ::= print_to_item - print_to_item ::= DUP_TOP expr ROT_TWO PRINT_ITEM_TO - ''' + # def p_print_to(self, args): + # ''' + # stmt ::= print_to + # stmt ::= print_to_nl + # stmt ::= print_nl_to + # print_to ::= expr print_to_items POP_TOP + # print_to_nl ::= expr print_to_items PRINT_NEWLINE_TO + # print_nl_to ::= expr PRINT_NEWLINE_TO + # print_to_items ::= print_to_items print_to_item + # print_to_items ::= print_to_item + # print_to_item ::= DUP_TOP expr ROT_TWO PRINT_ITEM_TO + # ''' def p_import20(self, args): '''