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

Travis Oliphant oliphant at ee.byu.edu
Sat Oct 8 15:31:45 EDT 2005


Gerard Vermeulen wrote:

>--- 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.
>+                */
>  
>
The problem is that when data is NULL, flags should only be used to 
indicate a fortran-style array.  Thus, the bug is in PyArray_FromDims 
(it should not be using CARRAY_FLAGS).

Thanks for finding this.

-Travis





More information about the SciPy-User mailing list