From 7b9e98d1c7a877ca58c4bcaa38b0571938fb28ca Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 21 Apr 2022 10:36:27 +0200 Subject: [PATCH] BUG: Allow legacy dtypes to cast to datetime again This constraint was added out of a caution with the thought that nobody uses it. Turns out ora does use it. In practice, this only affects cast to and from datetimes (or possibly strings but that seems even less likely). Tested via ora (see gh-21365) the paths are not particularly special, but the parametric dtype resolution is in principle missing. This is not particularly problematic, since NumPy barely exposes that though, and it never worked. Closes gh-21365 --- numpy/core/src/multiarray/convert_datatype.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c index 3135d69894b3..5d215a647f8a 100644 --- a/numpy/core/src/multiarray/convert_datatype.c +++ b/numpy/core/src/multiarray/convert_datatype.c @@ -106,9 +106,6 @@ PyArray_GetCastingImpl(PyArray_DTypeMeta *from, PyArray_DTypeMeta *to) return NULL; } else { - if (NPY_DT_is_parametric(from) || NPY_DT_is_parametric(to)) { - Py_RETURN_NONE; - } /* Reject non-legacy dtypes (they need to use the new API) */ if (!NPY_DT_is_legacy(from) || !NPY_DT_is_legacy(to)) { Py_RETURN_NONE;