[Numpy-discussion] cmp_arg_types bug?

Neal Becker ndbecker2@gmail....
Fri Feb 22 12:13:06 CST 2008


cmp_arg_types(int *arg1, int *arg2, int n)
{
    while (n--) {
        if (PyArray_EquivTypenums(*arg1, *arg2)) continue;
        if (PyArray_CanCastSafely(*arg1, *arg2))
            return -1;
        return 1;
    }
    return 0;
}

IIUC, if can cast (arg1, arg2), we never compare other args, just return -1.

Shouldn't this be:
cmp_arg_types(int *arg1, int *arg2, int n)
{
    while (n--) {
        if (PyArray_EquivTypenums(*arg1, *arg2) or
           (PyArray_CanCastSafely(*arg1, *arg2))
            continue;
        return 1;
    }
    return 0;
}



More information about the Numpy-discussion mailing list