Skip to content

Commit

Permalink
modulegraph: implement 'yield from'
Browse files Browse the repository at this point in the history
  • Loading branch information
xoviat committed Apr 5, 2021
1 parent 4a28d90 commit edc41d1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions PyInstaller/lib/modulegraph/util.py
Expand Up @@ -136,16 +136,12 @@ def iterate_instructions(code_object):
Yields `dis.Instruction`. After each code-block (`co_code`), `None` is
yielded to mark the end of the block and to interrupt the steam.
"""
# TODO: Implement "yield from" for python 3

for instruction in get_instructions(code_object):
yield instruction
yield from get_instructions(code_object)

yield None

# For each constant in this code object that is itself a code object,
# parse this constant in the same manner.
for constant in code_object.co_consts:
if inspect.iscode(constant):
for instruction in iterate_instructions(constant):
yield instruction
yield from iterate_instructions(constant)

0 comments on commit edc41d1

Please sign in to comment.