Repository: numpy/numpy
File: numpy/_core/src/umath/ufunc_object.c (C)

Code before:
                if (tmp == Py_Ellipsis) {
                    PyErr_SetString(PyExc_TypeError,
                        "out=... is only allowed as a keyword argument.");
                    goto fail;
                }
                if (tmp != Py_None) {
                    all_none = NPY_FALSE;
                }
            }
            else {
                tmp = Py_None;
            }
            Py_INCREF(tmp);
            PyTuple_SET_ITEM(full_args.out, i-nin, tmp);
        }

        /* Extra positional args but no keywords */
        /* DEPRECATED NumPy 2.4, 2025-08 */
        if ((PyObject *)ufunc == n_ops.maximum || (PyObject *)ufunc == n_ops.minimum) {
            
            if (DEPRECATE(
                "Passing more than 2 positional arguments to np.maximum and np.minimum "
                "is deprecated. If you meant to use the third argument as an output, " 
                "use the 'out' keyword argument instead. If you hoped to work with "
                "more than 2 inputs, combine them into a single array and get the extrema "
                "for the relevant axis.") < 0) {
                return NULL;
            }
        }
        
        if (all_none) {
            Py_SETREF(full_args.out, NULL);
        }
    }
    else {
        full_args.out = NULL;
    }

    /*
     * We have now extracted (but not converted) the input arguments.
     * To simplify overrides, extract all other arguments (as objects only)
     */
    PyObject *out_obj = NULL, *where_obj = NULL;
    PyObject *axes_obj = NULL, *axis_obj = NULL;
    PyObject *keepdims_obj = NULL, *casting_obj = NULL, *order_obj = NULL;
    PyObject *subok_obj = NULL, *signature_obj = NULL, *sig_obj = NULL;
    PyObject *dtype_obj = NULL;
    /* Typically, NumPy defaults to returnin scalars for 0-D results */
    npy_bool return_scalar = NPY_TRUE;

    /* Skip parsing if there are no keyword arguments, nothing left to do */

Review comment (suggestion):
FWIW, often `functools.reduce()` is probably better... but I guess this is still the saner thing to recommend.

Code after:
                if (tmp == Py_Ellipsis) {
                    PyErr_SetString(PyExc_TypeError,
                        "out=... is only allowed as a keyword argument.");
                    goto fail;
                }
                if (tmp != Py_None) {
                    all_none = NPY_FALSE;
                }
            }
            else {
                tmp = Py_None;
            }
            Py_INCREF(tmp);
            PyTuple_SET_ITEM(full_args.out, i-nin, tmp);
        }

        /* Extra positional args but no keywords */
        /* DEPRECATED NumPy 2.4, 2025-08 */
        if ((PyObject *)ufunc == n_ops.maximum || (PyObject *)ufunc == n_ops.minimum) {
            
            if (DEPRECATE(
                "Passing more than 2 positional arguments to np.maximum and np.minimum "
                "is deprecated. If you meant to use the third argument as an output, " 
                "use the `out` keyword argument instead. If you hoped to work with "
                "more than 2 inputs, combine them into a single array and get the extrema "
                "for the relevant axis.") < 0) {
                return NULL;
            }
        }
        
        if (all_none) {
            Py_SETREF(full_args.out, NULL);
        }
    }
    else {
        full_args.out = NULL;
    }

    /*
     * We have now extracted (but not converted) the input arguments.
     * To simplify overrides, extract all other arguments (as objects only)
     */
    PyObject *out_obj = NULL, *where_obj = NULL;
    PyObject *axes_obj = NULL, *axis_obj = NULL;
    PyObject *keepdims_obj = NULL, *casting_obj = NULL, *order_obj = NULL;
    PyObject *subok_obj = NULL, *signature_obj = NULL, *sig_obj = NULL;
    PyObject *dtype_obj = NULL;
    /* Typically, NumPy defaults to returnin scalars for 0-D results */
    npy_bool return_scalar = NPY_TRUE;

    /* Skip parsing if there are no keyword arguments, nothing left to do */