Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/coverage/bytecode.py: 40%
10 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 06:09 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 06:09 +0000
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
4"""Bytecode manipulation for coverage.py"""
6import types
9def 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