summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/scalartypes.inc.src8
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/core/src/scalartypes.inc.src b/numpy/core/src/scalartypes.inc.src
index 27d37a1a5..3371722d1 100644
--- a/numpy/core/src/scalartypes.inc.src
+++ b/numpy/core/src/scalartypes.inc.src
@@ -1286,7 +1286,7 @@ gentype_reduce(PyObject *self, PyObject *args)
tmp = _pya_malloc(buflen*2);
if (tmp == NULL) {
Py_DECREF(ret);
- return Py_NoMemory();
+ return PyErr_NoMemory();
}
alloc = 1;
newlen = PyUCS2Buffer_AsUCS4((Py_UNICODE *)buffer,
@@ -1299,12 +1299,14 @@ gentype_reduce(PyObject *self, PyObject *args)
mod = PyString_FromStringAndSize(buffer, buflen);
if (mod == NULL) {
Py_DECREF(ret);
- return Py_NoMemory();
+ ret = NULL;
+ goto fail;
}
PyTuple_SET_ITEM(ret, 1,
Py_BuildValue("NN", obj, mod));
+ fail:
#ifndef Py_UNICODE_WIDE
- if (alloc) _pya_free(buffer);
+ if (alloc) _pya_free((char *)buffer);
#endif
}
return ret;