| 3151 | } |
| 3152 | |
| 3153 | static PyObject * |
| 3154 | array_arange(PyObject *NPY_UNUSED(ignored), |
| 3155 | PyObject *const *args, Py_ssize_t len_args, PyObject *kwnames) |
| 3156 | { |
| 3157 | PyObject *o_start = NULL, *o_stop = NULL, *o_step = NULL, *range=NULL; |
| 3158 | PyArray_Descr *typecode = NULL; |
| 3159 | PyObject *like = Py_None; |
| 3160 | NPY_PREPARE_ARGPARSER; |
| 3161 | |
| 3162 | if (npy_parse_arguments("arange", args, len_args, kwnames, |
| 3163 | "|start", NULL, &o_start, |
| 3164 | "|stop", NULL, &o_stop, |
| 3165 | "|step", NULL, &o_step, |
| 3166 | "|dtype", &PyArray_DescrConverter2, &typecode, |
| 3167 | "$like", NULL, &like, |
| 3168 | NULL, NULL, NULL) < 0) { |
| 3169 | Py_XDECREF(typecode); |
| 3170 | return NULL; |
| 3171 | } |
| 3172 | if (like != Py_None) { |
| 3173 | PyObject *deferred = array_implement_c_array_function_creation( |
| 3174 | "arange", like, NULL, NULL, args, len_args, kwnames); |
| 3175 | if (deferred != Py_NotImplemented) { |
| 3176 | Py_XDECREF(typecode); |
| 3177 | return deferred; |
| 3178 | } |
| 3179 | } |
| 3180 | |
| 3181 | if (o_stop == NULL) { |
| 3182 | if (len_args == 0){ |
| 3183 | PyErr_SetString(PyExc_TypeError, |
| 3184 | "arange() requires stop to be specified."); |
| 3185 | Py_XDECREF(typecode); |
| 3186 | return NULL; |
| 3187 | } |
| 3188 | } |
| 3189 | else if (o_start == NULL) { |
| 3190 | o_start = o_stop; |
| 3191 | o_stop = NULL; |
| 3192 | } |
| 3193 | |
| 3194 | range = PyArray_ArangeObj(o_start, o_stop, o_step, typecode); |
| 3195 | Py_XDECREF(typecode); |
| 3196 | |
| 3197 | return range; |
| 3198 | } |
| 3199 | |
| 3200 | /*NUMPY_API |
| 3201 | * |
nothing calls this directly
no test coverage detected