DebugClients/Python/coverage/bytecode.py

branch
debugger speed
changeset 5178
878ce843ca9f
parent 5051
3586ebd9fac8
equal deleted inserted replaced
5174:8c48f5e0cd92 5178:878ce843ca9f
1 # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
3
4 """Bytecode manipulation for coverage.py"""
5
6 import types
7
8
9 class CodeObjects(object):
10 """Iterate over all the code objects in `code`."""
11 def __init__(self, code):
12 self.stack = [code]
13
14 def __iter__(self):
15 while self.stack:
16 # We're going to return the code object on the stack, but first
17 # push its children for later returning.
18 code = self.stack.pop()
19 for c in code.co_consts:
20 if isinstance(c, types.CodeType):
21 self.stack.append(c)
22 yield code

eric ide

mercurial