diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-08-08 05:13:02 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-08-08 05:13:02 +0000 |
commit | 50a50441a148a9ea3fbc1629e065d88a4f28a419 (patch) | |
tree | cc974798d0e964f7c55f160e8e16bb5cce8f4eaa /numpy | |
parent | fec6f0838c8c35709f4e8ef6753f6a1e5a88647c (diff) | |
download | numpy-50a50441a148a9ea3fbc1629e065d88a4f28a419.tar.gz |
Fix segfault in Ticket #238
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/arraymethods.c | 6 | ||||
-rw-r--r-- | numpy/numarray/alter_code1.py | 10 |
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'] |