Ejemplo n.º 1
0
    def RAISE_VARARGS(self, instr):
        nargs = instr.oparg

        cause = None
        exc = None

        if nargs > 1:
            cause = self.ast_stack.pop()
        if nargs > 0:
            exc = self.ast_stack.pop()

        raise_ = _ast.Raise(exc=exc, cause=cause,
                            lineno=instr.lineno, col_offset=0)
        self.ast_stack.append(raise_)
Ejemplo n.º 2
0
    def RAISE_VARARGS(self, instr):
        nargs = instr.oparg

        tback = None
        inst = None
        type = None
        if nargs > 2:
            tback = self.ast_stack.pop()
        if nargs > 1:
            inst = self.ast_stack.pop()
        if nargs > 0:
            type = self.ast_stack.pop()

        raise_ = _ast.Raise(tback=tback, inst=inst, type=type,
                            lineno=instr.lineno, col_offset=0)
        self.ast_stack.append(raise_)
Ejemplo n.º 3
0
    def RAISE_VARARGS(self, instr):
        nargs = instr.oparg

        cause = None
        exc = None

        if nargs > 1:
            cause = self.pop_ast_item()
        if nargs > 0:
            exc = self.pop_ast_item()

        raise_ = _ast.Raise(exc=exc,
                            cause=cause,
                            lineno=instr.lineno,
                            col_offset=0)
        self.push_ast_item(raise_)
Ejemplo n.º 4
0
def raise_stmt(exc: _ast.expr) -> _ast.Raise:
    return _ast.Raise(exc=exc, cause=None)