[Numpy-svn] r4465 - in trunk/numpy/core: src tests

numpy-svn@scip... numpy-svn@scip...
Sat Nov 17 18:02:22 CST 2007


Author: stefan
Date: 2007-11-17 18:00:37 -0600 (Sat, 17 Nov 2007)
New Revision: 4465

Modified:
   trunk/numpy/core/src/multiarraymodule.c
   trunk/numpy/core/tests/test_regression.py
Log:
Fix arange output byteorder.  Closes ticket #616.


Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2007-11-16 11:35:11 UTC (rev 4464)
+++ trunk/numpy/core/src/multiarraymodule.c	2007-11-18 00:00:37 UTC (rev 4465)
@@ -6806,6 +6806,7 @@
     funcs->fill(PyArray_DATA(range), length, (PyArrayObject *)range);
     if (PyErr_Occurred()) goto fail;
 
+ finish:
     if (swap) {
         PyObject *new;
         new = PyArray_Byteswap((PyArrayObject *)range, 1);
@@ -6814,7 +6815,6 @@
         PyArray_DESCR(range) = dtype;  /* steals the reference */
     }
 
- finish:
     Py_DECREF(start);
     Py_DECREF(step);
     Py_DECREF(next);

Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2007-11-16 11:35:11 UTC (rev 4464)
+++ trunk/numpy/core/tests/test_regression.py	2007-11-18 00:00:37 UTC (rev 4465)
@@ -748,5 +748,13 @@
         new = cPickle.loads(cPickle.dumps(el))
         assert_equal(new, el)
 
+    def check_arange_non_native_dtype(self, level=rlevel):
+        """Ticket #616"""
+        for T in ('>f4','<f4'):
+            dt = N.dtype(T)
+            assert_equal(N.arange(0,dtype=dt).dtype,dt)
+            assert_equal(N.arange(0.5,dtype=dt).dtype,dt)
+            assert_equal(N.arange(5,dtype=dt).dtype,dt)
+
 if __name__ == "__main__":
     NumpyTest().run()



More information about the Numpy-svn mailing list