modulefinder.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:oil 作者: oilshell 项目源码 文件源码
def scan_opcodes(self, co,
                     unpack = struct.unpack):
        # Scan the code, and yield 'interesting' opcode combinations
        # Version for Python 2.4 and older
        code = co.co_code
        names = co.co_names
        consts = co.co_consts
        opargs = [(op, arg) for _, op, arg in _unpack_opargs(code)
                  if op != EXTENDED_ARG]
        for i, (op, oparg) in enumerate(opargs):
            if c in STORE_OPS:
                yield "store", (names[oparg],)
                continue
            if (op == IMPORT_NAME and i >= 1
                    and opargs[i-1][0] == LOAD_CONST):
                fromlist = consts[opargs[i-1][1]]
                yield "import", (fromlist, names[oparg])
                continue
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号