summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorEric Cousineau <eric.cousineau@tri.global>2018-05-11 02:42:05 -0400
committerEric Cousineau <eric.cousineau@tri.global>2018-05-11 02:42:05 -0400
commitef2bd6ad2b30478944e0fc74607e3c86cba6e8b0 (patch)
tree8f5f649d505f16f84f8a0cf1f9e0b2a38fe80511 /numpy
parentcc8cef9c24abfcae4ff7acd8e85bd1c3307b41e3 (diff)
downloadnumpy-ef2bd6ad2b30478944e0fc74607e3c86cba6e8b0.tar.gz
BUG: Ensure `PyArray_AssignRawScalar` respects `NPY_NEEDS_INIT`
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/array_assign_scalar.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/array_assign_scalar.c b/numpy/core/src/multiarray/array_assign_scalar.c
index 3d259ae05..17de99cb9 100644
--- a/numpy/core/src/multiarray/array_assign_scalar.c
+++ b/numpy/core/src/multiarray/array_assign_scalar.c
@@ -245,6 +245,10 @@ PyArray_AssignRawScalar(PyArrayObject *dst,
allocated_src_data = 1;
}
+ if (PyDataType_FLAGCHK(PyArray_DESCR(dst), NPY_NEEDS_INIT)) {
+ memset(tmp_src_data, 0, PyArray_DESCR(dst)->elsize);
+ }
+
if (PyArray_CastRawArrays(1, src_data, tmp_src_data, 0, 0,
src_dtype, PyArray_DESCR(dst), 0) != NPY_SUCCEED) {
src_data = tmp_src_data;