From 3c901b49bd8715c93824c27682d81434d869498a Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Thu, 24 Jun 2021 11:16:22 -0400 Subject: pass descriptor rather than null --- numpy/core/src/multiarray/convert_datatype.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'numpy') diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c index 716e5dd3d..1bba276d2 100644 --- a/numpy/core/src/multiarray/convert_datatype.c +++ b/numpy/core/src/multiarray/convert_datatype.c @@ -417,9 +417,6 @@ PyArray_GetCastSafety( if (to != NULL) { to_dtype = NPY_DTYPE(to); } - if (from == NULL) { - return -1; - } PyObject *meth = PyArray_GetCastingImpl(NPY_DTYPE(from), to_dtype); if (meth == NULL) { return -1; @@ -3297,8 +3294,8 @@ void_to_void_resolve_descriptors( } } - PyArray_Descr *from_base = (from_sub == NULL) ? NULL : from_sub->base; - PyArray_Descr *to_base = (to_sub == NULL) ? NULL : to_sub->base; + PyArray_Descr *from_base = (from_sub == NULL) ? given_descrs[0] : from_sub->base; + PyArray_Descr *to_base = (to_sub == NULL) ? given_descrs[1] : to_sub->base; NPY_CASTING field_casting = PyArray_GetCastSafety(from_base, to_base, NULL); if (field_casting < 0) { return -1; -- cgit v1.2.1