diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-01-25 12:08:36 -0600 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2022-01-29 06:04:34 -0800 |
commit | d70702cca056e1c9c4419ea6d3ec71d7708fe281 (patch) | |
tree | c01b7ebeb995ddeb4df833d0b6914fdff89fdf3f | |
parent | 20d5bb76dc0d1324ccc7a9ffa6932ea1bbf1af4d (diff) | |
download | numpy-d70702cca056e1c9c4419ea6d3ec71d7708fe281.tar.gz |
API: Allow setting `_get_loop` from experimental API
Get-loop as a mechanism is pretty important to be public, just the
signature should probably be modified in the future.
So we should make it public, but not hold back on replacing it
(and deprecating the current version).
To re-iterate the two main changes, I see are:
1. `move_references` is mostly unused and not good API. I believe
it is only used for transfer to NULL. But that means it is only
used as a DECREF function. A DECREF function is special enough
to be special though.
2. I do not like `aligned` as a single flag, I am considering if we
should pass a power-of-two alignment, stored in a byte for each
"operand". In theory 4-bits of information seem enough for this.
(3-bits only reaches `2**(2**3-1) == 128`, so 4 seems better.)
-rw-r--r-- | numpy/core/src/multiarray/array_method.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/numpy/core/src/multiarray/array_method.c b/numpy/core/src/multiarray/array_method.c index b421d9e4f..a9512146a 100644 --- a/numpy/core/src/multiarray/array_method.c +++ b/numpy/core/src/multiarray/array_method.c @@ -261,12 +261,17 @@ fill_arraymethod_from_slots( meth->resolve_descriptors = slot->pfunc; continue; case NPY_METH_get_loop: - if (private) { - /* Only allow override for private functions initially */ - meth->get_strided_loop = slot->pfunc; - continue; - } - break; + /* + * NOTE: get_loop is considered "unstable" in the public API, + * I do not like the signature, and the `move_references` + * parameter must NOT be used. + * (as in: we should not worry about changing it, but of + * course that would not break it immediately.) + */ + /* Only allow override for private functions initially */ + meth->get_strided_loop = slot->pfunc; + continue; + /* "Typical" loops, supported used by the default `get_loop` */ case NPY_METH_strided_loop: meth->strided_loop = slot->pfunc; continue; |