[Numpy-discussion] PR for complex np.interp, question about assert_almost_equal

Peter Creasey p.e.creasey.00 at googlemail.com
Tue Dec 22 18:36:10 EST 2015

>>> The tests pass on my machine, but I see that the TravisCI builds are
>>> giving assertion fails (on my own test) with python 3.3 and 3.5 of the
>>> form:
>>> > assert_almost_equal
>>> > TypeError: Cannot cast array data from dtype('complex128') to
>>> dtype('float64') according to the rule 'safe'
> The problem then is probably here
> <https://github.com/numpy/numpy/pull/6872/files#diff-45aacfd88a495829ee10815c1d02326fL623>
> .
> You may want to throw in a PyErr_Clear()
> <https://docs.python.org/3/c-api/exceptions.html#c.PyErr_Clear> when the
> conversion of the fp array to NPY_DOUBLE fails before trying with
> NPY_CDOUBLE, and check if it goes away.

Thanks for your tip Jaime, you were exactly right. Unfortunately I
only saw your message after and addressed the problem in a different
way to your suggestion (passing in a flag instead). It'd be great to
have your input on the PR though (maybe github or pm me, to avoid
flooding the mailing list).


More information about the NumPy-Discussion mailing list