summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2020-02-04 12:57:27 +0000
committerEric Wieser <wieser.eric@gmail.com>2020-02-04 13:14:12 +0000
commita2c6c451cdbfa97210199c9f32455a46eec06686 (patch)
tree2dbd5447d52f12b3f2c89588f22f6c6dc1f49b74 /numpy/core
parent85be00ab0c36ded200747f5b82ab52e74db80b8f (diff)
downloadnumpy-a2c6c451cdbfa97210199c9f32455a46eec06686.tar.gz
MAINT: Do not allow `copyswap` and friends to fail silently
If these can't do the work that is requested, then we should fail loudly, at least during development. Really the API of these methods is wrong - they should take a `PyArray_Descr`, not an array.
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/src/multiarray/arraytypes.c.src6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src
index 61270dbef..ce288d62e 100644
--- a/numpy/core/src/multiarray/arraytypes.c.src
+++ b/numpy/core/src/multiarray/arraytypes.c.src
@@ -2290,6 +2290,7 @@ static void
STRING_copyswapn (char *dst, npy_intp dstride, char *src, npy_intp sstride,
npy_intp n, int NPY_UNUSED(swap), PyArrayObject *arr)
{
+ assert(arr != NULL);
if (arr == NULL) {
return;
}
@@ -2304,6 +2305,7 @@ VOID_copyswapn (char *dst, npy_intp dstride, char *src, npy_intp sstride,
{
PyArray_Descr *descr;
+ assert(arr != NULL);
if (arr == NULL) {
return;
}
@@ -2394,6 +2396,7 @@ VOID_copyswap (char *dst, char *src, int swap, PyArrayObject *arr)
{
PyArray_Descr *descr;
+ assert(arr != NULL);
if (arr == NULL) {
return;
}
@@ -2475,6 +2478,7 @@ UNICODE_copyswapn (char *dst, npy_intp dstride, char *src, npy_intp sstride,
{
int itemsize;
+ assert(arr != NULL);
if (arr == NULL) {
return;
}
@@ -2502,6 +2506,7 @@ UNICODE_copyswapn (char *dst, npy_intp dstride, char *src, npy_intp sstride,
static void
STRING_copyswap(char *dst, char *src, int NPY_UNUSED(swap), PyArrayObject *arr)
{
+ assert(arr != NULL);
if (arr == NULL) {
return;
}
@@ -2514,6 +2519,7 @@ UNICODE_copyswap (char *dst, char *src, int swap, PyArrayObject *arr)
{
int itemsize;
+ assert(arr != NULL);
if (arr == NULL) {
return;
}