src/eric7/DebugClients/Python/coverage/bytecode.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8312
800c432b34c8
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
3
4 """Bytecode manipulation for coverage.py"""
5
6 import types
7
8
9 def code_objects(code):
10 """Iterate over all the code objects in `code`."""
11 stack = [code]
12 while stack:
13 # We're going to return the code object on the stack, but first
14 # push its children for later returning.
15 code = stack.pop()
16 for c in code.co_consts:
17 if isinstance(c, types.CodeType):
18 stack.append(c)
19 yield code

eric ide

mercurial