Hi all,I just accidentally passed None in to a cython function that is expecting a numpy array, and got a hard crash. I boiled it down to a trivial example:
import cython
import numpy as np
cimport numpy as np
def none_test(np.ndarray[np.uint8_t, ndim=1, mode="c"] a):
return a
when I test it, it does raise exceptions if I pass in a string, or a
numpy array of the wrong shape or dtype, but not when I pass in None.
I think I saw something in the docs about None no being well behaved, but it seems that a check for it in this sort of case would be a good idea -- None turns up in the darndest places in Python...
-Chris Attached some test code... -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected]
test_cython_none.py
Description: application/python
import cython
import numpy as np
cimport numpy as np
def none_test(np.ndarray[np.uint8_t, ndim=1, mode="c"] a):
return a
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
