summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2021-11-12 15:51:12 -0600
committerSebastian Berg <sebastian@sipsolutions.net>2021-11-12 15:51:12 -0600
commitdea40555bd90afb368917dab31e613e00f1f6665 (patch)
tree8ed44d3064530d528d04ca23e0262ca569734624 /numpy
parentf31c4a66ad27b428b6a20f9fa28c1b33854ea949 (diff)
downloadnumpy-dea40555bd90afb368917dab31e613e00f1f6665.tar.gz
MAINT: Rename `allow_copy` to `never_copy` in never-copy machinery
The first name was `do_copy`, which was confusing because it sounds like a copy is forced (opposite is the case!) `allow_copy` would have been better, but corrects it into the wrong direction. `never_copy` is correct, and aligns with the Python side names
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/array_coercion.c14
-rw-r--r--numpy/core/src/multiarray/array_coercion.h2
-rw-r--r--numpy/core/src/multiarray/ctors.c8
-rw-r--r--numpy/core/src/multiarray/ctors.h2
4 files changed, 13 insertions, 13 deletions
diff --git a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiarray/array_coercion.c
index d58dd5d21..2598e4bde 100644
--- a/numpy/core/src/multiarray/array_coercion.c
+++ b/numpy/core/src/multiarray/array_coercion.c
@@ -858,7 +858,7 @@ PyArray_AdaptDescriptorToArray(PyArrayObject *arr, PyObject *dtype)
* (Initially it is a pointer to the user-provided head pointer).
* @param fixed_DType User provided fixed DType class
* @param flags Discovery flags (reporting and behaviour flags, see def.)
- * @param allow_copy Specifies if a copy is allowed during array creation.
+ * @param never_copy Specifies if a copy is allowed during array creation.
* @return The updated number of maximum dimensions (i.e. scalars will set
* this to the current dimensions).
*/
@@ -868,7 +868,7 @@ PyArray_DiscoverDTypeAndShape_Recursive(
npy_intp out_shape[NPY_MAXDIMS],
coercion_cache_obj ***coercion_cache_tail_ptr,
PyArray_DTypeMeta *fixed_DType, enum _dtype_discovery_flags *flags,
- int allow_copy)
+ int never_copy)
{
PyArrayObject *arr = NULL;
PyObject *seq;
@@ -926,7 +926,7 @@ PyArray_DiscoverDTypeAndShape_Recursive(
requested_descr = *out_descr;
}
arr = (PyArrayObject *)_array_from_array_like(obj,
- requested_descr, 0, NULL, allow_copy);
+ requested_descr, 0, NULL, never_copy);
if (arr == NULL) {
return -1;
}
@@ -1120,7 +1120,7 @@ PyArray_DiscoverDTypeAndShape_Recursive(
max_dims = PyArray_DiscoverDTypeAndShape_Recursive(
objects[i], curr_dims + 1, max_dims,
out_descr, out_shape, coercion_cache_tail_ptr, fixed_DType,
- flags, allow_copy);
+ flags, never_copy);
if (max_dims < 0) {
return -1;
@@ -1160,7 +1160,7 @@ PyArray_DiscoverDTypeAndShape_Recursive(
* The result may be unchanged (remain NULL) when converting a
* sequence with no elements. In this case it is callers responsibility
* to choose a default.
- * @param allow_copy Specifies if a copy is allowed during array creation.
+ * @param never_copy Specifies that a copy is not allowed.
* @return dimensions of the discovered object or -1 on error.
* WARNING: If (and only if) the output is a single array, the ndim
* returned _can_ exceed the maximum allowed number of dimensions.
@@ -1173,7 +1173,7 @@ PyArray_DiscoverDTypeAndShape(
npy_intp out_shape[NPY_MAXDIMS],
coercion_cache_obj **coercion_cache,
PyArray_DTypeMeta *fixed_DType, PyArray_Descr *requested_descr,
- PyArray_Descr **out_descr, int allow_copy)
+ PyArray_Descr **out_descr, int never_copy)
{
coercion_cache_obj **coercion_cache_head = coercion_cache;
*coercion_cache = NULL;
@@ -1218,7 +1218,7 @@ PyArray_DiscoverDTypeAndShape(
int ndim = PyArray_DiscoverDTypeAndShape_Recursive(
obj, 0, max_dims, out_descr, out_shape, &coercion_cache,
- fixed_DType, &flags, allow_copy);
+ fixed_DType, &flags, never_copy);
if (ndim < 0) {
goto fail;
}
diff --git a/numpy/core/src/multiarray/array_coercion.h b/numpy/core/src/multiarray/array_coercion.h
index 4790d8030..f2482cecc 100644
--- a/numpy/core/src/multiarray/array_coercion.h
+++ b/numpy/core/src/multiarray/array_coercion.h
@@ -31,7 +31,7 @@ PyArray_DiscoverDTypeAndShape(
npy_intp out_shape[NPY_MAXDIMS],
coercion_cache_obj **coercion_cache,
PyArray_DTypeMeta *fixed_DType, PyArray_Descr *requested_descr,
- PyArray_Descr **out_descr, int allow_copy);
+ PyArray_Descr **out_descr, int never_copy);
NPY_NO_EXPORT int
PyArray_ExtractDTypeAndDescriptor(PyObject *dtype,
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index 3f1d7835e..819bb22be 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -1284,7 +1284,7 @@ fail:
* DType may be used, but is not enforced.
* @param writeable whether the result must be writeable.
* @param context Unused parameter, must be NULL (should be removed later).
- * @param allow_copy Specifies if a copy is allowed during array creation.
+ * @param never_copy Specifies that a copy is not allowed.
*
* @returns The array object, Py_NotImplemented if op is not array-like,
* or NULL with an error set. (A new reference to Py_NotImplemented
@@ -1293,7 +1293,7 @@ fail:
NPY_NO_EXPORT PyObject *
_array_from_array_like(PyObject *op,
PyArray_Descr *requested_dtype, npy_bool writeable, PyObject *context,
- int allow_copy) {
+ int never_copy) {
PyObject* tmp;
/*
@@ -1349,7 +1349,7 @@ _array_from_array_like(PyObject *op,
* this should be changed!
*/
if (!writeable && tmp == Py_NotImplemented) {
- tmp = PyArray_FromArrayAttr_int(op, requested_dtype, allow_copy);
+ tmp = PyArray_FromArrayAttr_int(op, requested_dtype, never_copy);
if (tmp == NULL) {
return NULL;
}
@@ -2467,7 +2467,7 @@ PyArray_FromInterface(PyObject *origin)
* @param op The Python object to convert to an array.
* @param descr The desired `arr.dtype`, passed into the `__array__` call,
* as information but is not checked/enforced!
- * @param never_copy Indicator that a copy is not allowed.
+ * @param never_copy Specifies that a copy is not allowed.
* NOTE: Currently, this means an error is raised instead of calling
* `op.__array__()`. In the future we could call for example call
* `op.__array__(never_copy=True)` instead.
diff --git a/numpy/core/src/multiarray/ctors.h b/numpy/core/src/multiarray/ctors.h
index 2f9e8547d..98160b1cc 100644
--- a/numpy/core/src/multiarray/ctors.h
+++ b/numpy/core/src/multiarray/ctors.h
@@ -33,7 +33,7 @@ PyArray_New(
NPY_NO_EXPORT PyObject *
_array_from_array_like(PyObject *op,
PyArray_Descr *requested_dtype, npy_bool writeable, PyObject *context,
- int allow_copy);
+ int never_copy);
NPY_NO_EXPORT PyObject *
PyArray_FromAny(PyObject *op, PyArray_Descr *newtype, int min_depth,