diff --git a/test/bytecode_3.4/07_classderef.pyc-notyet b/test/bytecode_3.4/07_classderef.pyc-notyet new file mode 100644 index 00000000..f054281e Binary files /dev/null and b/test/bytecode_3.4/07_classderef.pyc-notyet differ diff --git a/test/bytecode_3.4/11_classbug_subclass_fn.pyc b/test/bytecode_3.4/11_classbug_subclass_fn.pyc new file mode 100644 index 00000000..429842bc Binary files /dev/null and b/test/bytecode_3.4/11_classbug_subclass_fn.pyc differ diff --git a/test/simple_source/def/07_classderef.py b/test/simple_source/def/07_classderef.py new file mode 100644 index 00000000..73881f6c --- /dev/null +++ b/test/simple_source/def/07_classderef.py @@ -0,0 +1,7 @@ +# From 3.4 ctypes/__init__.py +# For opcode LOAD_CLASSDEREF + +def CFUNCTYPE(argtypes): + class CFunctionType(object): + _argtypes_ = argtypes + return CFunctionType diff --git a/test/simple_source/def/11_classbug_subclass_fn.py b/test/simple_source/def/11_classbug_subclass_fn.py new file mode 100644 index 00000000..05415a67 --- /dev/null +++ b/test/simple_source/def/11_classbug_subclass_fn.py @@ -0,0 +1,5 @@ +# From python 3.4 endian.py +# Bug was having two CALL_FUNCTION ops in bytecode. +from ctypes import * +class _swapped_meta(type(Structure)): + pass diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 08838e90..9cc35b7a 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -400,9 +400,11 @@ class Python3Parser(PythonParser): call_function)) self.add_unique_rule(rule, opname, token.attr, customize) - # Can the above build_class rule be folded into this rule? + # FIXME: What's the deal with the two rules? Different Python versions? + # Different situations? Note that the above rule is based on the CALL_FUNCTION + # token found, while this one doesn't. rule = ("build_class ::= LOAD_BUILD_CLASS mkfunc expr call_function " - "CALL_FUNCTION_" + str(args_pos+1)) + "CALL_FUNCTION_3") self.add_unique_rule(rule, opname, token.attr, customize) return