instructions.py 文件源码

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

项目:Vanstein 作者: SunDwarf 项目源码 文件源码
def RAISE_VARARGS(ctx: _VSContext, instruction: dis.Instruction):
    """
    Raises an exception to either the current scope or the outer scope.
    """
    # This is relatively simple.
    # We ignore the argc == 3, and pretend it's argc == 2
    argc = instruction.arg
    if argc == 3:
        # fuck you
        ctx.pop()
        argc = 2

    if argc == 2:
        # FROM exception is Top of stack now.
        fr = ctx.pop()
        # The real exception is top of stack now.
        exc = ctx.pop()
        exc.__cause__ = fr

    elif argc == 1:
        exc = ctx.pop()
    else:
        # Bare raise.
        exc = ctx._exception_state

    # Inject the exception.
    safe_raise(ctx, exc)
    # Raise the exception.

    return exc


# endregion
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号