summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/arraytypes.inc.src5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/src/arraytypes.inc.src b/numpy/core/src/arraytypes.inc.src
index dda7aba87..844890434 100644
--- a/numpy/core/src/arraytypes.inc.src
+++ b/numpy/core/src/arraytypes.inc.src
@@ -637,7 +637,10 @@ VOID_setitem(PyObject *op, char *ip, PyArrayObject *ap)
}
res = PyObject_AsReadBuffer(op, &buffer, &buflen);
if (res == -1) goto fail;
- memcpy(ip, buffer, MIN(buflen, itemsize));
+ memcpy(ip, buffer, NPY_MIN(buflen, itemsize));
+ if (itemsize > buflen) {
+ memset(ip+buflen, 0, (itemsize-buflen));
+ }
}
return 0;