diff options
author | wfspotz@sandia.gov <wfspotz@sandia.gov@localhost> | 2007-04-11 16:50:38 +0000 |
---|---|---|
committer | wfspotz@sandia.gov <wfspotz@sandia.gov@localhost> | 2007-04-11 16:50:38 +0000 |
commit | d594e08d048df6c1452b9fb0172071bdec82f306 (patch) | |
tree | a2a4d49b0ee888cb73429e0e09019a1189f4053a /numpy/doc/swig | |
parent | 9e0cfafb432664acf08e6573876622e9c546df8a (diff) | |
download | numpy-d594e08d048df6c1452b9fb0172071bdec82f306.tar.gz |
Provided more sophisticated typecheck typemap for IN_ARRAYs
Diffstat (limited to 'numpy/doc/swig')
-rw-r--r-- | numpy/doc/swig/numpy.i | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/numpy/doc/swig/numpy.i b/numpy/doc/swig/numpy.i index bb5fcef4f..e63ba3c21 100644 --- a/numpy/doc/swig/numpy.i +++ b/numpy/doc/swig/numpy.i @@ -445,7 +445,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DATA_TYPE IN_ARRAY1[ANY]) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DATA_TYPE IN_ARRAY1[ANY]) @@ -467,7 +467,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) @@ -490,7 +490,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) @@ -513,7 +513,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DATA_TYPE IN_ARRAY2[ANY][ANY]) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DATA_TYPE IN_ARRAY2[ANY][ANY]) @@ -535,7 +535,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) @@ -559,7 +559,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) @@ -583,7 +583,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) @@ -606,7 +606,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) @@ -632,7 +632,7 @@ int require_size(PyArrayObject* ary, npy_intp* size, int n) { %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) { - $1 = ($input != NULL); + $1 = is_array($input) || PySequence_Check($input); } %typemap(in) (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) |