eric6/DebugClients/Python/coverage/bytecode.py

changeset 6942
2602857055c5
parent 5178
878ce843ca9f
child 7427
362cd1b6f81a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
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