diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/upcoming_changes/15355.c_api.rst | 7 | ||||
-rw-r--r-- | doc/source/reference/c-api/ufunc.rst | 62 |
2 files changed, 39 insertions, 30 deletions
diff --git a/doc/release/upcoming_changes/15355.c_api.rst b/doc/release/upcoming_changes/15355.c_api.rst new file mode 100644 index 000000000..ffc1972cf --- /dev/null +++ b/doc/release/upcoming_changes/15355.c_api.rst @@ -0,0 +1,7 @@ +Const qualify UFunc inner loops
+-------------------------------
+``UFuncGenericFunction`` now expects pointers to const ``dimension`` and
+``strides`` as arguments. This means inner loops may no longer modify
+either ``dimension`` or ``strides``. This change leads to an
+``incompatible-pointer-types`` warning forcing users to either ignore
+the compiler warnings or to const qualify their own loop signatures.
diff --git a/doc/source/reference/c-api/ufunc.rst b/doc/source/reference/c-api/ufunc.rst index c9cc60141..ec23adf2d 100644 --- a/doc/source/reference/c-api/ufunc.rst +++ b/doc/source/reference/c-api/ufunc.rst @@ -77,7 +77,7 @@ Functions signature: .. c:function:: void loopfunc( - char** args, npy_intp* dimensions, npy_intp* steps, void* data) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* data) *args* @@ -108,8 +108,10 @@ Functions .. code-block:: c static void - double_add(char **args, npy_intp *dimensions, npy_intp *steps, - void *extra) + double_add(char **args, + npy_intp const *dimensions, + npy_intp const *steps, + void *extra) { npy_intp i; npy_intp is1 = steps[0], is2 = steps[1]; @@ -311,37 +313,37 @@ functions stored in the functions member of the PyUFuncObject structure. .. c:function:: void PyUFunc_f_f_As_d_d( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_d_d( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_f_f( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_g_g( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_F_F_As_D_D( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_F_F( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_D_D( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_G_G( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_e_e( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_e_e_As_f_f( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_e_e_As_d_d( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) Type specific, core 1-d functions for ufuncs where each calculation is obtained by calling a function taking one input @@ -357,37 +359,37 @@ structure. C-function that takes double and returns double. .. c:function:: void PyUFunc_ff_f_As_dd_d( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_ff_f( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_dd_d( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_gg_g( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_FF_F_As_DD_D( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_DD_D( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_FF_F( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_GG_G( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_ee_e( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_ee_e_As_ff_f( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_ee_e_As_dd_d( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) Type specific, core 1-d functions for ufuncs where each calculation is obtained by calling a function taking two input @@ -400,10 +402,10 @@ structure. to use the underlying function that takes a different data type. .. c:function:: void PyUFunc_O_O( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) .. c:function:: void PyUFunc_OO_O( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) One-input, one-output, and two-input, one-output core 1-d functions for the :c:data:`NPY_OBJECT` data type. These functions handle reference @@ -413,7 +415,7 @@ structure. PyObject *)`` for :c:func:`PyUFunc_OO_O`. .. c:function:: void PyUFunc_O_O_method( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) This general purpose 1-d core function assumes that *func* is a string representing a method of the input object. For each @@ -421,7 +423,7 @@ structure. and its *func* method is called returning the result to the output array. .. c:function:: void PyUFunc_OO_O_method( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) This general purpose 1-d core function assumes that *func* is a string representing a method of the input object that takes one @@ -431,7 +433,7 @@ structure. of *args*. .. c:function:: void PyUFunc_On_Om( \ - char** args, npy_intp* dimensions, npy_intp* steps, void* func) + char** args, npy_intp const *dimensions, npy_intp const *steps, void* func) This is the 1-d core function used by the dynamic ufuncs created by umath.frompyfunc(function, nin, nout). In this case *func* is a |