#17878 BUG: np.arange: Allow `stop` not `start` as sole kwargs.

Merged MaiaKaplan
Coverage Reach
core/src/multiarray/multiarraymodule.c core/src/multiarray/dtype_transfer.c core/src/multiarray/datetime.c core/src/multiarray/arraytypes.c.src core/src/multiarray/descriptor.c core/src/multiarray/ctors.c core/src/multiarray/scalartypes.c.src core/src/multiarray/nditer_api.c core/src/multiarray/mapping.c core/src/multiarray/item_selection.c core/src/multiarray/nditer_constr.c core/src/multiarray/methods.c core/src/multiarray/nditer_pywrap.c core/src/multiarray/_multiarray_tests.c.src core/src/multiarray/convert_datatype.c core/src/multiarray/compiled_base.c core/src/multiarray/einsum_sumprod.c.src core/src/multiarray/dragon4.c core/src/multiarray/iterators.c core/src/multiarray/arrayobject.c core/src/multiarray/datetime_strings.c core/src/multiarray/calculation.c core/src/multiarray/datetime_busday.c core/src/multiarray/lowlevel_strided_loops.c.src core/src/multiarray/buffer.c core/src/multiarray/getset.c core/src/multiarray/array_coercion.c core/src/multiarray/conversion_utils.c core/src/multiarray/einsum.c.src core/src/multiarray/number.c core/src/multiarray/shape.c core/src/multiarray/scalarapi.c core/src/multiarray/legacy_dtype_implementation.c core/src/multiarray/flagsobject.c core/src/multiarray/convert.c core/src/multiarray/dtypemeta.c core/src/multiarray/array_method.c core/src/multiarray/usertypes.c core/src/multiarray/datetime_busdaycal.c core/src/multiarray/nditer_templ.c.src core/src/multiarray/common.c core/src/multiarray/arrayfunction_override.c core/src/multiarray/refcount.c core/src/multiarray/array_assign_array.c core/src/multiarray/hashdescr.c core/src/multiarray/temp_elide.c core/src/multiarray/alloc.c core/src/multiarray/array_assign_scalar.c core/src/multiarray/vdot.c core/src/multiarray/common.h core/src/multiarray/abstractdtypes.c core/src/multiarray/strfuncs.c core/src/multiarray/typeinfo.c core/src/multiarray/sequence.c core/src/multiarray/methods.h core/src/multiarray/nditer_impl.h core/src/multiarray/dtypemeta.h core/src/multiarray/alloc.h core/src/umath/ufunc_object.c core/src/umath/loops.c.src core/src/umath/simd.inc.src core/src/umath/ufunc_type_resolution.c core/src/umath/_rational_tests.c.src core/src/umath/override.c core/src/umath/scalarmath.c.src core/src/umath/_umath_tests.c.src core/src/umath/matmul.c.src core/src/umath/funcs.inc.src core/src/umath/umathmodule.c core/src/umath/extobj.c core/src/umath/reduction.c core/src/umath/_struct_ufunc_tests.c.src core/src/umath/loops_unary_fp.dispatch.c.src core/src/umath/_operand_flag_tests.c.src core/src/umath/clip.c.src core/src/umath/loops_utils.h core/src/umath/_umath_tests.dispatch.c core/src/umath/fast_loop_macros.h core/src/npysort/timsort.c.src core/src/npysort/quicksort.c.src core/src/npysort/mergesort.c.src core/src/npysort/heapsort.c.src core/src/npysort/selection.c.src core/src/npysort/radixsort.c.src core/src/npysort/npysort_common.h core/src/npysort/binsearch.c.src core/src/common/simd/sse/memory.h core/src/common/simd/sse/arithmetic.h core/src/common/simd/sse/operators.h core/src/common/simd/sse/reorder.h core/src/common/simd/sse/misc.h core/src/common/simd/sse/math.h core/src/common/simd/avx2/memory.h core/src/common/simd/avx2/reorder.h core/src/common/simd/avx2/operators.h core/src/common/simd/avx2/arithmetic.h core/src/common/simd/avx2/misc.h core/src/common/simd/avx2/math.h core/src/common/simd/avx2/utils.h core/src/common/simd/avx512/memory.h core/src/common/simd/avx512/reorder.h core/src/common/simd/avx512/arithmetic.h core/src/common/simd/avx512/operators.h core/src/common/simd/avx512/misc.h core/src/common/simd/avx512/math.h core/src/common/cblasfuncs.c core/src/common/mem_overlap.c core/src/common/numpyos.c core/src/common/npy_extint128.h core/src/common/npy_cpu_features.c.src core/src/common/npy_longdouble.c core/src/common/lowlevel_strided_loops.h core/src/common/array_assign.c core/src/common/ufunc_override.c core/src/common/get_attr_string.h core/src/common/ucsnarrow.c core/src/common/binop_override.h core/src/common/npy_binsearch.h.src core/src/common/python_xerbla.c core/src/common/npy_ctypes.h core/src/common/npy_partition.h.src core/src/common/npy_import.h core/src/common/npy_cblas.h core/src/common/npy_sort.h.src core/src/common/templ_common.h.src core/src/npymath/halffloat.c core/src/npymath/ieee754.c.src core/src/npymath/npy_math_internal.h.src core/src/npymath/npy_math_complex.c.src core/src/_simd/_simd.dispatch.c.src core/src/_simd/_simd_convert.inc core/src/_simd/_simd_vector.inc core/src/_simd/_simd_arg.inc core/src/_simd/_simd.c core/include/numpy/npy_3kcompat.h core/include/numpy/libdivide/libdivide.h core/include/numpy/ndarraytypes.h core/include/numpy/npy_math.h core/include/numpy/ndarrayobject.h core/include/numpy/_neighborhood_iterator_imp.h core/include/numpy/random/distributions.h random/src/distributions/distributions.c random/src/distributions/random_hypergeometric.c random/src/distributions/random_mvhg_count.c random/src/distributions/random_mvhg_marginals.c random/src/distributions/logfactorial.c random/src/legacy/legacy-distributions.c random/src/mt19937/mt19937-jump.c random/src/mt19937/mt19937.c random/src/mt19937/mt19937.h random/src/philox/philox.h random/src/philox/philox.c random/src/pcg64/pcg64.c random/src/pcg64/pcg64.h random/src/sfc64/sfc64.c random/src/sfc64/sfc64.h fft/_pocketfft.c linalg/umath_linalg.c.src linalg/lapack_litemodule.c linalg/lapack_lite/python_xerbla.c

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 2 files from the diff.

@@ -2930,7 +2930,7 @@
Loading
2930 2930
    static char *kwd[] = {"start", "stop", "step", "dtype", "like", NULL};
2931 2931
    PyArray_Descr *typecode = NULL;
2932 2932
2933 -
    if (!PyArg_ParseTupleAndKeywords(args, kws, "O|OOO&$O:arange", kwd,
2933 +
    if (!PyArg_ParseTupleAndKeywords(args, kws, "|OOOO&$O:arange", kwd,
2934 2934
                &o_start,
2935 2935
                &o_stop,
2936 2936
                &o_step,
@@ -2940,6 +2940,18 @@
Loading
2940 2940
        return NULL;
2941 2941
    }
2942 2942
2943 +
    if (o_stop == NULL) {
2944 +
        if (args == NULL || PyTuple_GET_SIZE(args) == 0){
2945 +
            PyErr_SetString(PyExc_TypeError,
2946 +
                "arange() requires stop to be specified.");
2947 +
            return NULL;
2948 +
        }
2949 +
    }
2950 +
    else if (o_start == NULL) {
2951 +
        o_start = o_stop;
2952 +
        o_stop = NULL;
2953 +
    }
2954 +
2943 2955
    array_function_result = array_implement_c_array_function_creation(
2944 2956
            "arange", args, kws);
2945 2957
    if (array_function_result != Py_NotImplemented) {

Learn more Showing 26 files with coverage changes found.

Changes in numpy/core/src/multiarray/convert_datatype.c
+68
+192
Loading file...
Changes in numpy/core/src/multiarray/_multiarray_tests.c.src
+11
+36
Loading file...
Changes in numpy/core/src/multiarray/datetime.c
+85
+60
Loading file...
Changes in numpy/core/src/multiarray/dtypemeta.c
+2
+3
Loading file...
Changes in numpy/core/src/multiarray/usertypes.c
+9
+8
Loading file...
Changes in numpy/core/src/umath/scalarmath.c.src
+2
+2
Loading file...
Changes in numpy/core/src/multiarray/dtype_transfer.c
+12
Loading file...
Changes in numpy/core/src/umath/loops.c.src
+45
+10
Loading file...
Changes in numpy/core/src/multiarray/multiarraymodule.c
-11
+2
Loading file...
Changes in numpy/core/src/multiarray/arrayobject.c
+1
Loading file...
Changes in numpy/core/src/multiarray/compiled_base.c
-9
Loading file...
Changes in numpy/core/src/multiarray/scalartypes.c.src
+11
+3
Loading file...
Changes in numpy/core/src/umath/ufunc_type_resolution.c
New
Loading file...
Changes in numpy/core/include/numpy/ndarraytypes.h
New
Loading file...
New file numpy/core/src/multiarray/legacy_dtype_implementation.c
New
Loading file...
New file numpy/core/include/numpy/libdivide/libdivide.h
New
Loading file...
New file numpy/core/src/multiarray/array_method.c
New
Loading file...
Changes in numpy/core/src/multiarray/mapping.c
+3
Loading file...
Changes in numpy/core/src/umath/ufunc_object.c
-1
+1
Loading file...
Changes in numpy/core/src/multiarray/arrayfunction_override.c
+6
Loading file...
Changes in numpy/core/src/multiarray/array_coercion.c
-1
+1
Loading file...
Changes in numpy/core/src/multiarray/scalarapi.c
-1
+1
Loading file...
Changes in numpy/core/src/multiarray/ctors.c
-9
+12
Loading file...
Changes in numpy/core/src/multiarray/buffer.c
-27
-7
Loading file...
Changes in numpy/core/src/multiarray/lowlevel_strided_loops.c.src
-6
+6
Loading file...
Changes in numpy/core/src/npymath/npy_math_internal.h.src
+26
Loading file...
Files Coverage
numpy -0.56% 82.09%
Project Totals (160 files) 82.09%
Loading