diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-07-15 10:21:46 -0500 |
|---|---|---|
| committer | Sebastian Berg <sebastian@sipsolutions.net> | 2021-07-22 15:59:10 -0500 |
| commit | 0db5f7dea4c1553a838e3649e3b8909f9802284b (patch) | |
| tree | ad80052442ff2091d7747ad8d32d448727928db3 | |
| parent | adfd2e9c7d54ceaa118d4ca025c30d4407b4e5b8 (diff) | |
| download | numpy-0db5f7dea4c1553a838e3649e3b8909f9802284b.tar.gz | |
WIP: Comments from Matti and some start on iterating
| -rw-r--r-- | numpy/core/src/multiarray/array_method.c | 1 | ||||
| -rw-r--r-- | numpy/core/src/umath/dispatching.c | 11 | ||||
| -rw-r--r-- | numpy/core/src/umath/legacy_array_method.c | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/array_method.c b/numpy/core/src/multiarray/array_method.c index 02e7a6787..f9c17fd11 100644 --- a/numpy/core/src/multiarray/array_method.c +++ b/numpy/core/src/multiarray/array_method.c @@ -864,6 +864,7 @@ PyArrayMethod_GetMaskedStridedLoop( aligned, 0, fixed_strides, &data->unmasked_stridedloop, &data->unmasked_auxdata, flags) < 0) { PyMem_Free(data); + return -1; } *out_transferdata = (NpyAuxData *)data; *out_loop = generic_masked_strided_loop; diff --git a/numpy/core/src/umath/dispatching.c b/numpy/core/src/umath/dispatching.c index 090c0b63b..6c8c9d9e4 100644 --- a/numpy/core/src/umath/dispatching.c +++ b/numpy/core/src/umath/dispatching.c @@ -102,7 +102,9 @@ add_ufunc_loop(PyUFuncObject *ufunc, PyObject *info, int ignore_duplicate) return -1; } - PyList_Append(loops, info); + if (PyList_Append(loops, info) < 0) { + return -1; + } return 0; } @@ -229,6 +231,10 @@ resolve_implementation_info(PyUFuncObject *ufunc, /* equivalent, so this entry does not matter */ continue; } + /* + * TODO: The `abstract` paths and all subclass checks are not + * actually used right now. This will b + */ if (is_not_specified) { /* * When DType is completely unspecified, prefer abstract @@ -495,6 +501,7 @@ legacy_promote_using_legacy_type_resolver(PyUFuncObject *ufunc, Py_XDECREF(type_tuple); for (int i = 0; i < nargs; i++) { + // TODO: Check that this is correct with INCREF: Stop using borrowed references! (Then this is actually correct) operation_DTypes[i] = NPY_DTYPE(out_descrs[i]); Py_INCREF(operation_DTypes[i]); Py_DECREF(out_descrs[i]); @@ -551,6 +558,7 @@ add_and_return_legacy_wrapping_ufunc_loop(PyUFuncObject *ufunc, } +// TODO: Note the entry-point anymore. /* * The central entry-point for the promotion and dispatching machinery. * It currently works with the operands (although it would be possible to @@ -576,6 +584,7 @@ promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc, return info; } + // TODO: Add comment here what this does. if (info == NULL) { if (resolve_implementation_info(ufunc, op_dtypes, &info) < 0) { return NULL; diff --git a/numpy/core/src/umath/legacy_array_method.c b/numpy/core/src/umath/legacy_array_method.c index aaeb5209d..0b60e4fb2 100644 --- a/numpy/core/src/umath/legacy_array_method.c +++ b/numpy/core/src/umath/legacy_array_method.c @@ -90,6 +90,7 @@ generic_wrapped_legacy_loop(PyArrayMethod_Context *NPY_UNUSED(context), } +// TODO: Rearrange the comment and shorten (probably just to the last line). /* * This just seems to tricky to make work correctly, there are two main * problems: First, the resolver really would like the ufunc to be passed in |
