summaryrefslogtreecommitdiff
path: root/numpy/core/src/multiarray
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2022-12-01 17:08:10 +0100
committerSebastian Berg <sebastianb@nvidia.com>2022-12-01 17:08:10 +0100
commit84b428e053021466dc52426cc7172db84ab19d0d (patch)
treebde4160640be7196e737b01e90874b83498ea280 /numpy/core/src/multiarray
parent680a6f29bb5887db6b0931e9a7e041e8f74b9cc3 (diff)
downloadnumpy-84b428e053021466dc52426cc7172db84ab19d0d.tar.gz
API: Always reject equal/not_equal for datetime/timedelta mix
This allows correctly cathing the error, also adjust the the NoLoop error is used for the the "binary no loop error". For now, I think I may want to keep the casting error distinct.
Diffstat (limited to 'numpy/core/src/multiarray')
-rw-r--r--numpy/core/src/multiarray/dtypemeta.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/dtypemeta.c b/numpy/core/src/multiarray/dtypemeta.c
index 1f5325576..5549000ae 100644
--- a/numpy/core/src/multiarray/dtypemeta.c
+++ b/numpy/core/src/multiarray/dtypemeta.c
@@ -617,6 +617,12 @@ string_unicode_common_dtype(PyArray_DTypeMeta *cls, PyArray_DTypeMeta *other)
static PyArray_DTypeMeta *
datetime_common_dtype(PyArray_DTypeMeta *cls, PyArray_DTypeMeta *other)
{
+ /*
+ * Timedelta/datetime shouldn't actuall promote at all. That they
+ * currently do means that we need additional hacks in the comparison
+ * type resolver. For comparisons we have to make sure we reject it
+ * nicely in order to return an array of True/False values.
+ */
if (cls->type_num == NPY_DATETIME && other->type_num == NPY_TIMEDELTA) {
/*
* TODO: We actually currently do allow promotion here. This is