Skip to content

Error when parsing fortran code with abstract interface #18403

@jhaiduce

Description

@jhaiduce

f2py appears to be missing support for abstract interfaces. Attempting to parse code containing an abstract interface produces an error.

Reproducing code example:

from numpy.f2py.crackfortran import crackfortran

crackfortran('test_interface.F90')

test_interface.F90:

module test
  abstract interface
  end interface
end module test

Error message:

Traceback (most recent call last):
  File "/Users/jhaiduce/Development/lightda/test_interface_crackfortran.py", line 3, in <module>
    crackfortran('test_interface.F90')
  File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 3310, in crackfortran
    readfortrancode(files, crackline)
  File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 526, in readfortrancode
    dowithline(finalline)
  File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 759, in crackline
    raise Exception('crackline: groupcounter(=%s) is nonpositive. '
Exception: crackline: groupcounter(=0) is nonpositive. Check the blocks.

NumPy/Python version information:

1.20.1 3.9.1 (default, Feb 3 2021, 07:04:48)
[Clang 11.0.0 (clang-1100.0.33.17)]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions