[SciPy-user] newcore-1209: PyArray_New() returns fortran arrays when flags == CARRAY_FLAGS

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Sat Oct 8 08:25:07 EDT 2005


--- newcore/scipy/base/src/arrayobject.c.gv     2005-10-08 08:16:28.000000000 +0200
+++ newcore/scipy/base/src/arrayobject.c        2005-10-08 13:35:27.000000000 +0200
@@ -29,7 +29,7 @@
 #include "structmember.h"

 #define _MULTIARRAYMODULE
-#include "Numeric3/arrayobject.h"
+#include "scipy/base/arrayobject.h"
 */

 /* Helper functions */
@@ -3177,7 +3177,18 @@
        self->dimensions = NULL;
        if (data == NULL) {  /* strides is NULL too */
                self->flags = DEFAULT_FLAGS;
+#ifdef GOTCHA
+               /* The following test results in returning a fortran array,
+                  if the user (me) or eg PyArray_FromDims() passes in
+                  flags = CARRAY_FLAGS.
+                */
                if (flags) {
+#else
+               /* This fixes at least PyArray_FromDims(), but may break
+                  something else :-)
+                */
+               if (flags & FORTRAN) {
+#endif
                        self->flags |= FORTRAN;
                        if (nd > 1) self->flags &= ~CONTIGUOUS;
                        flags = FORTRAN;

Gerard




More information about the SciPy-User mailing list