diff --git a/test/bytecode_3.5/05_abc_class.pyc b/test/bytecode_3.5/05_abc_class.pyc new file mode 100644 index 00000000..d0b2c216 Binary files /dev/null and b/test/bytecode_3.5/05_abc_class.pyc differ diff --git a/test/bytecode_3.5/06_classbug.pyc b/test/bytecode_3.5/06_classbug.pyc index 3ac3ab0e..c3840c34 100644 Binary files a/test/bytecode_3.5/06_classbug.pyc and b/test/bytecode_3.5/06_classbug.pyc differ diff --git a/test/simple_source/def/05_abc_class.py b/test/simple_source/def/05_abc_class.py new file mode 100644 index 00000000..0d277593 --- /dev/null +++ b/test/simple_source/def/05_abc_class.py @@ -0,0 +1,14 @@ +# Python3.5 bug from abc.py: +# stmt ::= LOAD_CLOSURE RETURN_VALUE RETURN_LAST +# +# And this gets ignored. + +# Note this is similar to 06_classbug.py but not the same. +# classmethod -> object + +class abstractclassmethod(classmethod): + __isabstractmethod__ = True + + def __init__(self, callable): + callable.__isabstractmethod__ = True + super().__init__(callable) diff --git a/test/simple_source/def/06_classbug.py b/test/simple_source/def/06_classbug.py index 6539b14b..89f90445 100644 --- a/test/simple_source/def/06_classbug.py +++ b/test/simple_source/def/06_classbug.py @@ -5,6 +5,9 @@ # LOAD_FAST '__locals__' # STORE_LOCALS '' +# Note this is similar to 05_abc_class.py but not the same: +# object -> classmethod + class abstractclassmethod(object): """A Python 3.2 STORE_LOCALS bug """ diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 18f1d95e..8424b26c 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -545,7 +545,7 @@ class Python35onParser(Python3Parser): # this optimization is only used in Python 3.5 and beyond _ifstmts_jump ::= c_stmts_opt - # Python 3.5 has WITH_CLEANUP_START/FINISH + # Python 3.5+ has WITH_CLEANUP_START/FINISH withstmt ::= expr SETUP_WITH with_setup suite_stmts_opt POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY @@ -553,6 +553,9 @@ class Python35onParser(Python3Parser): withasstmt ::= expr SETUP_WITH designator suite_stmts_opt POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY + + # Python 3.5+ classes seem to end with this: + stmt ::= LOAD_CLOSURE RETURN_VALUE RETURN_LAST """ class Python35onParserSingle(Python35onParser, PythonParserSingle):