summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2017-12-29 11:13:20 +0100
committerStefan Krah <skrah@bytereef.org>2017-12-29 11:13:20 +0100
commit69c9bd44da05e84cff8e96feffb7801d886ea67a (patch)
treeebcd897c52dd475586aae05de0c5180b31f7eabe
parent7c8486de75e82cc9fd6a754ce0ede14579d44023 (diff)
downloadnumpy-69c9bd44da05e84cff8e96feffb7801d886ea67a.tar.gz
Check return value.
- tp_doc can handle NULL, but CPython compiled --with-pydebug aborts on non-NULL returns after an exception has been set.
-rw-r--r--numpy/core/src/multiarray/compiled_base.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarray/compiled_base.c
index 2f308c7d3..14f4a8f65 100644
--- a/numpy/core/src/multiarray/compiled_base.c
+++ b/numpy/core/src/multiarray/compiled_base.c
@@ -1441,6 +1441,9 @@ arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args)
}
docstr = PyUnicode_AsUTF8(str);
+ if (docstr == NULL) {
+ return NULL;
+ }
#else
if (!PyArg_ParseTuple(args, "OO!:add_docstring", &obj, &PyString_Type, &str)) {
return NULL;