summaryrefslogtreecommitdiff
path: root/numpy/f2py/src/fortranobject.c
diff options
context:
space:
mode:
authorNico Schlömer <nico.schloemer@gmail.com>2017-08-28 10:40:51 +0200
committerNico Schlömer <nico.schloemer@gmail.com>2017-08-28 10:40:51 +0200
commitdf7340694bac9452359e80e68dc43f0f4e1c1b8d (patch)
tree2fdcd815ed54110da309722eb5059b8f5deb23af /numpy/f2py/src/fortranobject.c
parent0032e535f7ebbcb4528dbbedb9c71b47914071c7 (diff)
downloadnumpy-df7340694bac9452359e80e68dc43f0f4e1c1b8d.tar.gz
f2py: allow Fortran arrays of dimension 0
Up until now, f2py throw an error when arrays were declared which had dimension of length 0. This, however, is a perfectly legal case, and in fact occurs frequently in the context of linear algrebra. This bug was discovered, for example, in an interface that does matrix tridiagonalization. If the matrix is 1x1, the super- and subdiagonal are of length 0. Note that negative dimensions continue to produce errors although Fortran also allows this (it always allocates to size max(0, n)).
Diffstat (limited to 'numpy/f2py/src/fortranobject.c')
-rw-r--r--numpy/f2py/src/fortranobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c
index f2036c427..3b8eba649 100644
--- a/numpy/f2py/src/fortranobject.c
+++ b/numpy/f2py/src/fortranobject.c
@@ -599,7 +599,7 @@ count_nonpos(const int rank,
const npy_intp *dims) {
int i=0,r=0;
while (i<rank) {
- if (dims[i] <= 0) ++r;
+ if (dims[i] < 0) ++r;
++i;
}
return r;