Skip to content

Commit cb0ab45

Browse files
authored
Merge pull request #121 from ngoldbaum/delete-dead-code
Delete dead reduction promoter code
2 parents c24eafc + 214d99f commit cb0ab45

2 files changed

Lines changed: 2 additions & 19 deletions

File tree

‎src/csrc/umath/comparison_ops.cpp‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,16 +273,7 @@ NPY_NO_EXPORT int
273273
comparison_ufunc_promoter(PyObject *ufunc_obj, PyArray_DTypeMeta *const op_dtypes[],
274274
PyArray_DTypeMeta *const signature[], PyArray_DTypeMeta *new_op_dtypes[])
275275
{
276-
// Reduction: accumulator is Bool, element is QuadPrecDType, output is Bool
277-
if (op_dtypes[0] == NULL) {
278-
Py_INCREF(&PyArray_BoolDType);
279-
new_op_dtypes[0] = &PyArray_BoolDType;
280-
Py_INCREF(op_dtypes[1]);
281-
new_op_dtypes[1] = op_dtypes[1];
282-
Py_INCREF(&PyArray_BoolDType);
283-
new_op_dtypes[2] = &PyArray_BoolDType;
284-
return 0;
285-
}
276+
assert(op_dtypes[0] != NULL);
286277

287278
PyUFuncObject *ufunc = (PyUFuncObject *)ufunc_obj;
288279
if (quad_ufunc_has_object_input(ufunc, op_dtypes)) {

‎src/include/umath/promoters.hpp‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,7 @@ quad_ufunc_promoter(PyObject *ufunc_obj, PyArray_DTypeMeta *const op_dtypes[],
5757
PyUFuncObject *ufunc = (PyUFuncObject *)ufunc_obj;
5858
int nargs = ufunc->nargs;
5959

60-
// Handle the special case for reductions
61-
if (op_dtypes[0] == NULL) {
62-
assert(ufunc->nin == 2 && ufunc->nout == 1); /* must be reduction */
63-
for (int i = 0; i < 3; i++) {
64-
Py_INCREF(op_dtypes[1]);
65-
new_op_dtypes[i] = op_dtypes[1];
66-
}
67-
return 0;
68-
}
60+
assert(op_dtypes[0] != NULL);
6961

7062
PyArray_DTypeMeta *common_dtype = signature[ufunc->nin];
7163
for (int i = ufunc->nin + 1; i < nargs; i++) {

0 commit comments

Comments
 (0)