summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/arraymethods.c6
-rw-r--r--numpy/numarray/alter_code1.py10
2 files changed, 13 insertions, 3 deletions
diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c
index e13061a4e..cc885b90f 100644
--- a/numpy/core/src/arraymethods.c
+++ b/numpy/core/src/arraymethods.c
@@ -359,6 +359,12 @@ PyArray_Byteswap(PyArrayObject *self, Bool inplace)
copyswapn = self->descr->f->copyswapn;
if (inplace) {
+ if (!PyArray_ISWRITEABLE(self)) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Cannot byte-swap in-place on a " \
+ "read-only array");
+ return NULL;
+ }
size = PyArray_SIZE(self);
if (PyArray_ISONESEGMENT(self)) {
copyswapn(self->data, self->descr->elsize, NULL, -1, size, 1, self);
diff --git a/numpy/numarray/alter_code1.py b/numpy/numarray/alter_code1.py
index 3fb1acd74..07b74ada7 100644
--- a/numpy/numarray/alter_code1.py
+++ b/numpy/numarray/alter_code1.py
@@ -5,9 +5,9 @@ Makes the following changes:
* Changes import statements
Stubs for
- convolve --> numarray.convolve
- image --> numarray.image
- nd_image --> numarray.nd_image
+ numarray.convolve --> numpy.numarray.convolve
+ numarray.image --> numarray.image
+ numarray.nd_image --> numarray.nd_image
* Makes search and replace changes to:
- .imaginary --> .imag
@@ -50,6 +50,10 @@ import os
import re
import glob
+import warnings
+warnings.warn("numarray.alter_code1 is not working yet")
+
+
_func4 = ['eye', 'tri']
_meth1 = ['astype']