diff --git a/test/bytecode_3.4/05_yield_from.pyc b/test/bytecode_3.4/05_yield_from.pyc deleted file mode 100644 index 41523903..00000000 Binary files a/test/bytecode_3.4/05_yield_from.pyc and /dev/null differ diff --git a/test/bytecode_3.4/09_yield_from.pyc b/test/bytecode_3.4/09_yield_from.pyc new file mode 100644 index 00000000..12e5ef24 Binary files /dev/null and b/test/bytecode_3.4/09_yield_from.pyc differ diff --git a/test/bytecode_3.5/05_yield_from.pyc b/test/bytecode_3.5/05_yield_from.pyc deleted file mode 100644 index e5f186e2..00000000 Binary files a/test/bytecode_3.5/05_yield_from.pyc and /dev/null differ diff --git a/test/bytecode_3.5/09_yield_from.pyc b/test/bytecode_3.5/09_yield_from.pyc new file mode 100644 index 00000000..7dfbb7d9 Binary files /dev/null and b/test/bytecode_3.5/09_yield_from.pyc differ diff --git a/test/simple_source/expression/05_yield_from.py b/test/simple_source/expression/05_yield_from.py deleted file mode 100644 index f44c36e3..00000000 --- a/test/simple_source/expression/05_yield_from.py +++ /dev/null @@ -1,11 +0,0 @@ -# Python 3.3 and above only -# Tests - -# 3.3, 3.4 -# yield_from ::= expr expr YIELD_FROM -# expr ::= yield_from - -# 3.5: - -def _walk_dir(dir, ddir=None): - yield from _walk_dir(dir, ddir=dfile) diff --git a/test/simple_source/expression/09_yield_from.py b/test/simple_source/expression/09_yield_from.py new file mode 100644 index 00000000..a6dfebc9 --- /dev/null +++ b/test/simple_source/expression/09_yield_from.py @@ -0,0 +1,27 @@ +# Python 3.3 and above only +# Tests + +# 3.3, 3.4 +# yield_from ::= expr expr YIELD_FROM +# expr ::= yield_from + +# 3.5: +# yield_from ::= expr GET_YIELD_FROM_ITER LOAD_CONST YIELD_FROM + +def _walk_dir(dir, dfile, ddir=None): + yield from _walk_dir(dir, ddir=dfile) + +# From 3.5.1 _wakrefset.py +# +# 3.5: +# withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt +# POP_BLOCK LOAD_CONST COME_FROM +# WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY + + +def __iter__(self, IterationGuard): + with IterationGuard(self): + for itemref in self.data: + item = itemref() + if item is not None: + yield item diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index d113c8c7..038f4cab 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -582,6 +582,10 @@ class Python35onParser(Python3Parser): # Python 3.5+ has WITH_CLEANUP_START/FINISH withstmt ::= expr SETUP_WITH exprlist suite_stmts_opt + POP_BLOCK LOAD_CONST COME_FROM + WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY + + withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY