summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-02-04 09:07:33 -0800
committerGitHub <noreply@github.com>2020-02-04 09:07:33 -0800
commita9bc5db4671c6c702e3a8a35fbf31b8d3225fad2 (patch)
tree2dbd5447d52f12b3f2c89588f22f6c6dc1f49b74
parent85be00ab0c36ded200747f5b82ab52e74db80b8f (diff)
parenta2c6c451cdbfa97210199c9f32455a46eec06686 (diff)
downloadnumpy-a9bc5db4671c6c702e3a8a35fbf31b8d3225fad2.tar.gz
Merge pull request #15503 from eric-wieser/do-not-allow-copyswap-noop
MAINT: Do not allow `copyswap` and friends to fail silently
-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;
}