[Numpy-svn] r2974 - in trunk/numpy: core/src numarray
numpy-svn at scipy.org
numpy-svn at scipy.org
Tue Aug 8 01:13:08 EDT 2006
Author: oliphant
Date: 2006-08-08 00:13:02 -0500 (Tue, 08 Aug 2006)
New Revision: 2974
Modified:
trunk/numpy/core/src/arraymethods.c
trunk/numpy/numarray/alter_code1.py
Log:
Fix segfault in Ticket #238
Modified: trunk/numpy/core/src/arraymethods.c
===================================================================
--- trunk/numpy/core/src/arraymethods.c 2006-08-05 22:29:46 UTC (rev 2973)
+++ trunk/numpy/core/src/arraymethods.c 2006-08-08 05:13:02 UTC (rev 2974)
@@ -359,6 +359,12 @@
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);
Modified: trunk/numpy/numarray/alter_code1.py
===================================================================
--- trunk/numpy/numarray/alter_code1.py 2006-08-05 22:29:46 UTC (rev 2973)
+++ trunk/numpy/numarray/alter_code1.py 2006-08-08 05:13:02 UTC (rev 2974)
@@ -5,9 +5,9 @@
* 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,7 +50,11 @@
import re
import glob
+import warnings
+warnings.warn("numarray.alter_code1 is not working yet")
+
+
_func4 = ['eye', 'tri']
_meth1 = ['astype']
_func2 = ['ones', 'zeros', 'identity', 'fromstring', 'indices',
More information about the Numpy-svn
mailing list