Todo: 集成多平台 解决因SaiNiu线程抢占资源问题 本地提交测试环境打包 和 正式打包脚本与正式环境打包bat 提交Python32环境包 改进多日志文件生成情况修改打包日志细节
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import dis
|
||||
import inspect
|
||||
|
||||
|
||||
def iterate_instructions(code_object):
|
||||
"""Delivers the byte-code instructions as a continuous stream.
|
||||
|
||||
Yields `dis.Instruction`. After each code-block (`co_code`), `None` is
|
||||
yielded to mark the end of the block and to interrupt the steam.
|
||||
"""
|
||||
# The arg extension the EXTENDED_ARG opcode represents is automatically handled by get_instructions() but the
|
||||
# instruction is left in. Get rid of it to make subsequent parsing easier/safer.
|
||||
yield from (i for i in dis.get_instructions(code_object) if i.opname != "EXTENDED_ARG")
|
||||
|
||||
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):
|
||||
yield from iterate_instructions(constant)
|
||||
Reference in New Issue
Block a user