summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-05-11 15:12:37 -0600
committerGitHub <noreply@github.com>2018-05-11 15:12:37 -0600
commit4144a4722d050cf4d0c9ba343884f9cb4f3bb86f (patch)
tree3807fe2e86afc42c211aab0141ed1a3d78a48115 /numpy
parent798aee26bdb9dcc0e806ca9271f0f98297188dec (diff)
parentef2bd6ad2b30478944e0fc74607e3c86cba6e8b0 (diff)
downloadnumpy-4144a4722d050cf4d0c9ba343884f9cb4f3bb86f.tar.gz
Merge pull request #11076 from EricCousineau-TRI/issue/11075
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;