Esempio n. 1
0
def check_num_argsv(space, w_ob, low, high):
    from pypy.module.cpyext.tupleobject import PyTuple_CheckExact
    if not PyTuple_CheckExact(space, w_ob):
        raise oefmt(space.w_SystemError,
                    "PyArg_UnpackTuple() argument list is not a tuple")
    if low <= space.len_w(w_ob) <= high:
        return
    raise oefmt(space.w_TypeError, "expected %d-%d arguments, got %d", low,
                high, space.len_w(w_ob))
Esempio n. 2
0
def check_num_args(space, w_ob, n):
    from pypy.module.cpyext.tupleobject import PyTuple_CheckExact
    if not PyTuple_CheckExact(space, w_ob):
        raise OperationError(space.w_SystemError,
            space.wrap("PyArg_UnpackTuple() argument list is not a tuple"))
    if n == space.len_w(w_ob):
        return
    raise oefmt(space.w_TypeError,
                "expected %d arguments, got %d",
                n, space.len_w(w_ob))