diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2012-05-22 11:16:48 +0100 |
---|---|---|
committer | Nathaniel J. Smith <njs@pobox.com> | 2012-05-22 11:19:11 +0100 |
commit | 51616c9265155f75e536ba19c32f9f91337243af (patch) | |
tree | 34df89213915f49b08eaadb81d2b4fe7c8bd791c /numpy/numarray/_capi.c | |
parent | baaf1819e3e9319c58269a7a06eb4b20e0a08eec (diff) | |
download | numpy-51616c9265155f75e536ba19c32f9f91337243af.tar.gz |
Rename PyArray_RequireWriteable to PyArray_FailUnlessWriteable
Also clean up its API slightly so that the caller passes in a name
describing the array being checked which is used to generate an error
message, rather than writing an error message from scratch.
Diffstat (limited to 'numpy/numarray/_capi.c')
-rw-r--r-- | numpy/numarray/_capi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/numarray/_capi.c b/numpy/numarray/_capi.c index 6acf7324a..78187c50e 100644 --- a/numpy/numarray/_capi.c +++ b/numpy/numarray/_capi.c @@ -1082,7 +1082,7 @@ NA_OutputArray(PyObject *a, NumarrayType t, int requires) "NA_OutputArray: only arrays work for output."); return NULL; } - if (PyArray_RequireWriteable((PyArrayObject *)a, NULL) < 0) { + if (PyArray_FailUnlessWriteable((PyArrayObject *)a, "output array") < 0) { return NULL; } @@ -1128,7 +1128,7 @@ NA_IoArray(PyObject *a, NumarrayType t, int requires) /* Guard against non-writable, but otherwise satisfying requires. In this case, shadow == a. */ - if (!PyArray_RequireWriteable(shadow, NULL)) { + if (!PyArray_FailUnlessWriteable(shadow, "input/output array")) { PyArray_XDECREF_ERR(shadow); return NULL; } @@ -2487,7 +2487,7 @@ _setFromPythonScalarCore(PyArrayObject *a, long offset, PyObject*value, int entr static int NA_setFromPythonScalar(PyArrayObject *a, long offset, PyObject *value) { - if (PyArray_RequireWriteable(a, NULL) < 0) { + if (PyArray_FailUnlessWriteable(a, "array") < 0) { return -1; } return _setFromPythonScalarCore(a, offset, value, 0); |