f2py on module with allocatable string

236 views Asked by At

I have written a very simple module (test.f90)

module tt

implicit none
character(:),allocatable :: hh
contains
subroutine test()
    implicit none
    integer :: i
end subroutine
end module tt

I want now to wrap it into an object for Python using f2py.

I use the following commands:

gfortran-9 -c test.f90 -Wall
f2py -m g -c test.f90

But I obtain the following errors. These errors seems to be correlated with the allocatable string and I am currently not able to find a solution to remove it.

/var/folders/fg/53phbn8n6nd3vrhm3sh_36w40000gn/T/tmpjtueazku/src.macosx-10.7-x86_64-3.6/g-f2pywrappers2.f90:25:17:

   25 |        allocate(d(s(1)))
      |                 1
Error: Shape specification for allocatable scalar at (1)
/var/folders/fg/53phbn8n6nd3vrhm3sh_36w40000gn/T/tmpjtueazku/src.macosx-10.7-x86_64-3.6/g-f2pywrappers2.f90:16:22:

   16 |             if ((size(d,i).ne.s(i)).and.(s(i).ge.0)) then
      |                      1
Error: 'array' argument of 'size' intrinsic at (1) must be an array
/var/folders/fg/53phbn8n6nd3vrhm3sh_36w40000gn/T/tmpjtueazku/src.macosx-10.7-x86_64-3.6/g-f2pywrappers2.f90:29:24:

   29 |             s(i) = size(d,i)
      |                        1
Error: 'array' argument of 'size' intrinsic at (1) must be an array
0

There are 0 answers