From 4b034a96822d8452e3f4652a1c297bdff7391752 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Wed, 17 Feb 2021 12:19:39 -0600 Subject: DOC: Fix comments As noted by Matti and Ross, these comments were incorrect. Co-authored-by: Matti Picus Co-authored-by: Ross Barnowski --- numpy/core/include/numpy/ndarraytypes.h | 6 +++++- numpy/core/src/common/lowlevel_strided_loops.h | 15 ++++----------- numpy/core/src/multiarray/dtype_transfer.c | 2 +- numpy/core/src/multiarray/dtype_transfer.h | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h index 059fb2821..a731e7f15 100644 --- a/numpy/core/include/numpy/ndarraytypes.h +++ b/numpy/core/include/numpy/ndarraytypes.h @@ -1920,12 +1920,16 @@ typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size, default_descr_function *default_descr; common_dtype_function *common_dtype; common_instance_function *common_instance; + /* + * The casting implementation (ArrayMethod) to convert between two + * instances of this DType, stored explicitly for fast access: + */ + PyObject *within_dtype_castingimpl; /* * Dictionary of ArrayMethods representing most possible casts * (structured and object are exceptions). * This should potentially become a weak mapping in the future. */ - PyObject *within_dtype_castingimpl; PyObject *castingimpls; }; diff --git a/numpy/core/src/common/lowlevel_strided_loops.h b/numpy/core/src/common/lowlevel_strided_loops.h index 5dad9e5c5..1255e51dd 100644 --- a/numpy/core/src/common/lowlevel_strided_loops.h +++ b/numpy/core/src/common/lowlevel_strided_loops.h @@ -174,17 +174,10 @@ PyArray_GetDTypeCopySwapFn(int aligned, * If 0, the destination data gets new reference ownership. * If 1, the references from the source data are moved to * the destination data. - * out_stransfer: - * The resulting transfer function is placed here. - * out_transferdata: - * The auxiliary data for the transfer function is placed here. - * When finished with the transfer function, the caller must call - * NPY_AUXDATA_FREE on this data. - * context: - * A pointer to a PyArrayMethod_Context which is filled in the call. - * Note that `context->method` may be set to `NULL` e.g. for multi-step - * casts. The filled result is always valid as input to the returned - * `out_stransfer` function. + * cast_info: + * A pointer to an (uninitialized) `NPY_cast_info` struct, the caller + * must call `NPY_cast_info_xfree` on it (except on error) and handle + * its memory livespan. * out_needs_api: * If this is non-NULL, and the transfer function produced needs * to call into the (Python) API, this gets set to 1. This diff --git a/numpy/core/src/multiarray/dtype_transfer.c b/numpy/core/src/multiarray/dtype_transfer.c index f0bb62b89..eceb13fb7 100644 --- a/numpy/core/src/multiarray/dtype_transfer.c +++ b/numpy/core/src/multiarray/dtype_transfer.c @@ -2859,7 +2859,7 @@ _multistep_cast_auxdata_clone_int(_multistep_castdata *castdata, int move_info) newdata->from_buffer = char_data + from_buffer_offset; newdata->to_buffer = char_data + to_buffer_offset; - /* Initialize func's to NULL to signal no-cleanup in case of an error. */ + /* Initialize funcs to NULL to signal no-cleanup in case of an error. */ newdata->from.func = NULL; newdata->to.func = NULL; diff --git a/numpy/core/src/multiarray/dtype_transfer.h b/numpy/core/src/multiarray/dtype_transfer.h index 78b75d12f..e29ac40b8 100644 --- a/numpy/core/src/multiarray/dtype_transfer.h +++ b/numpy/core/src/multiarray/dtype_transfer.h @@ -10,7 +10,7 @@ * casts (e.g. structured dtypes). * * This struct provides a place to store all necessary information as - * compact as possible. It must be used with the inlie functions below + * compact as possible. It must be used with the inline functions below * to ensure correct setup and teardown. * * In general, the casting machinery currently handles the correct set up -- cgit v1.2.1