mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-10-07 10:13:39 +00:00
Another kind of yield_from on 3.5
This commit is contained in:
parent
126af429fb
commit
f999e6a33a
Binary file not shown.
BIN
test/bytecode_3.4/09_yield_from.pyc
Normal file
BIN
test/bytecode_3.4/09_yield_from.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/bytecode_3.5/09_yield_from.pyc
Normal file
BIN
test/bytecode_3.5/09_yield_from.pyc
Normal file
Binary file not shown.
@ -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)
|
27
test/simple_source/expression/09_yield_from.py
Normal file
27
test/simple_source/expression/09_yield_from.py
Normal file
@ -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
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user