diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-08-09 10:18:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-09 10:18:16 -0500 |
commit | c0b4340c698c486e459a0a2c80706c78329c64fc (patch) | |
tree | 4c4c978f8ca4a52f12b8fe3986f276f9a9aae7ea /numpy | |
parent | e079e33d5c2f20350de200a38c07b367910da277 (diff) | |
parent | f4ad61d540c5289b16be56340dd0b5ce8781d856 (diff) | |
download | numpy-c0b4340c698c486e459a0a2c80706c78329c64fc.tar.gz |
Merge pull request #11695 from eric-wieser/missing-PyErr_NoMemory
BUG: Add missing PyErr_NoMemory after failing malloc
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/buffer.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/buffer.c b/numpy/core/src/multiarray/buffer.c index 21dbdefd6..0325f3c6a 100644 --- a/numpy/core/src/multiarray/buffer.c +++ b/numpy/core/src/multiarray/buffer.c @@ -468,6 +468,7 @@ _buffer_info_new(PyObject *obj) info = malloc(sizeof(_buffer_info_t)); if (info == NULL) { + PyErr_NoMemory(); goto fail; } @@ -493,6 +494,7 @@ _buffer_info_new(PyObject *obj) else { info->shape = malloc(sizeof(Py_ssize_t) * PyArray_NDIM(arr) * 2 + 1); if (info->shape == NULL) { + PyErr_NoMemory(); goto fail; } info->strides = info->shape + PyArray_NDIM(arr); diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 938850997..a2cf17f4e 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -92,6 +92,7 @@ swab_separator(const char *sep) s = start = malloc(strlen(sep)+3); if (s == NULL) { + PyErr_NoMemory(); return NULL; } /* add space to front if there isn't one */ |