diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-01-02 15:40:08 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2016-01-02 16:01:17 -0700 |
commit | bba8647dbf7098ffcf6df70b959b6079b5682e0c (patch) | |
tree | 2e0a56d14b09b8816dd3dcf0409a15e0d78a0510 | |
parent | 9bd67153c6efab990b33ff34342b7782256de1f9 (diff) | |
download | numpy-bba8647dbf7098ffcf6df70b959b6079b5682e0c.tar.gz |
BUG: #6922: Fix segfault introduced in 23901aa.
Revert troublesome parts of gh-5929. Copyswap cannot be relied
upon for void types containing objects.
-rw-r--r-- | numpy/core/src/multiarray/arraytypes.c.src | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index 060f25098..b2ba831f4 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -2866,7 +2866,9 @@ VOID_compare(char *ip1, char *ip2, PyArrayObject *ap) if (nip1 == NULL) { goto finish; } - new->f->copyswap(nip1, ip1 + offset, swap, dummy); + memcpy(nip1, ip1 + offset, new->elsize); + if (swap) + new->f->copyswap(nip1, NULL, swap, dummy); } if (swap || !npy_is_aligned(nip2, new->alignment)) { /* create buffer and copy */ @@ -2877,7 +2879,9 @@ VOID_compare(char *ip1, char *ip2, PyArrayObject *ap) } goto finish; } - new->f->copyswap(nip2, ip2 + offset, swap, dummy); + memcpy(nip2, ip2 + offset, new->elsize); + if (swap) + new->f->copyswap(nip2, NULL, swap, dummy); } } res = new->f->compare(nip1, nip2, dummy); |