summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/release/upcoming_changes/18880.compatibility.rst2
-rw-r--r--doc/source/reference/ufuncs.rst5
-rw-r--r--numpy/core/src/umath/ufunc_type_resolution.c12
3 files changed, 13 insertions, 6 deletions
diff --git a/doc/release/upcoming_changes/18880.compatibility.rst b/doc/release/upcoming_changes/18880.compatibility.rst
index ed159cdfa..a6ae2e968 100644
--- a/doc/release/upcoming_changes/18880.compatibility.rst
+++ b/doc/release/upcoming_changes/18880.compatibility.rst
@@ -26,7 +26,7 @@ This means it is now always equivalent to::
to no loop being found in some cases, NumPy will normally also search
for the loop::
- signature("float64", "float64, "float64")
+ signature=("float64", "float64", "float64")
if the first search failed.
In the future, this behaviour may be customized to achieve the expected
diff --git a/doc/source/reference/ufuncs.rst b/doc/source/reference/ufuncs.rst
index b2906bcdf..27ebf8d1b 100644
--- a/doc/source/reference/ufuncs.rst
+++ b/doc/source/reference/ufuncs.rst
@@ -448,8 +448,9 @@ advanced usage and will not typically be used.
indicating the input and output types of a ufunc.
This argument allows the user to specify exact DTypes to be used for the
- calculation. Casting will be used as necessary. The input DType
- is not considered unless ``signature`` is ``None`` for that input.
+ calculation. Casting will be used as necessary. The actual DType of the
+ input arrays is not considered unless ``signature`` is ``None`` for
+ that array.
When all DTypes are fixed, a specific loop is chosen or an error raised
if no matching loop exists.
diff --git a/numpy/core/src/umath/ufunc_type_resolution.c b/numpy/core/src/umath/ufunc_type_resolution.c
index 0be85c1c4..d41b071f4 100644
--- a/numpy/core/src/umath/ufunc_type_resolution.c
+++ b/numpy/core/src/umath/ufunc_type_resolution.c
@@ -1922,7 +1922,10 @@ type_tuple_userloop_type_resolver(PyUFuncObject *self,
for (; funcdata != NULL; funcdata = funcdata->next) {
int *orig_types = funcdata->arg_types;
- /* Copy the types into an int array for matching */
+ /*
+ * Copy the types into an int array for matching
+ * (Mostly duplicated in `type_tuple_type_resolver`)
+ */
for (j = 0; j < nop; ++j) {
if (specified_types[j] == NPY_NOTYPE) {
types[j] = orig_types[j];
@@ -2121,7 +2124,7 @@ type_tuple_type_resolver_core(PyUFuncObject *self,
/* Error */
case -1:
return -1;
- /* Found matching loop */
+ /* Found matching loop */
case 1:
return 0;
}
@@ -2130,7 +2133,10 @@ type_tuple_type_resolver_core(PyUFuncObject *self,
for (i = 0; i < self->ntypes; ++i) {
char *orig_types = self->types + i*self->nargs;
- /* Check specified types and copy into an int array for matching */
+ /*
+ * Check specified types and copy into an int array for matching
+ * (Mostly duplicated in `type_tuple_userloop_type_resolver`)
+ */
for (j = 0; j < nop; ++j) {
if (specified_types[j] == NPY_NOTYPE) {
types[j] = orig_types[j];