Skip to content

Commit

Permalink
BUG: Allow legacy dtypes to cast to datetime again
Browse files Browse the repository at this point in the history
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
  • Loading branch information
seberg authored and charris committed May 5, 2022
1 parent 65bbf0c commit 7b9e98d
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions numpy/core/src/multiarray/convert_datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7b9e98d

Please sign in to comment.