BF: using numpy's isinf with gil. Apparently isinf is not defined in libc.math