From 51616c9265155f75e536ba19c32f9f91337243af Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Tue, 22 May 2012 11:16:48 +0100 Subject: 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. --- numpy/numarray/_capi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'numpy/numarray') 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); -- cgit v1.2.1