diff options
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r-- | numpy/core/src/arrayobject.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 859a4d79e..cf14b350e 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -6711,6 +6711,21 @@ PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to) return ret; } +/*OBJECT_API + See if array scalars can be cast. + */ +static Bool +PyArray_CanCastScalar(PyTypeObject *from, PyTypeObject *to) +{ + int fromtype; + int totype; + + fromtype = _typenum_fromtypeobj((PyObject *)from, 0); + totype = _typenum_fromtypeobj((PyObject *)to, 0); + if (fromtype == PyArray_NOTYPE || totype == PyArray_NOTYPE) + return FALSE; + return (Bool) PyArray_CanCastSafely(fromtype, totype); +} /*********************** Element-wise Array Iterator ***********************/ |