8000 BUG: crackfortran.py fails with 'common' blocks with Numpy version > 1.20 · Issue #22648 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
BUG: crackfortran.py fails with 'common' blocks with Numpy version > 1.20 #22648
Closed
@jarau-de

Description

@jarau-de

Describe the issue:

It seems Fortran 77 'COMMON' blocks are not matched correctly. I got the following error message:

crackline: groupcounter=1 groupname={0: '', 1: 'python module', 2: 'interface', 3: 'block data', 4: 'subroutine'}
crackline: Mismatch of blocks encountered. Trying to fix it by assuming "end" statement.

Following code causes the error:

python module iri16py ! in
interface ! in :iri16py
block data ! in :iri16py:iridreg_modified.for
COMMON /fircom/ eden,tabhe,tabla,tabmo,tabza,tabfl
end block data
end interface
end python module iri16py

Unfortunately all interface signature code after the common block will be ignored. With Numpy <= 1.20 it runs smooth. All versions above causes this error. If I document out the 'common' line all behaves fine. Please fix that soon. I tried to find out the reason in crackfortran.py, but it seems a bit too complex for me.
f2py seems also to be fine if one removes the space between end block data -> end blockdata.

Reproduce the code example:

f2py following code:
python module iri16py ! in 
    interface  ! in :iri16py
        block data  ! in :iri16py:iridreg_modified.for
           COMMON /fircom/ eden,tabhe,tabla,tabmo,tabza,tabfl
       end block data 
    end interface 
end python module iri16py

Error message:

crackline: groupcounter=1 groupname={0: '', 1: 'python module', 2: 'interface', 3: 'block data', 4: 'subroutine'}
crackline: Mismatch of blocks encountered. Trying to fix it by assuming "end" statement.

NumPy/Python version information:

1.21 and above

Context for the issue:

I use a Python module which make use of old Fortran 77 code. Since f2py ignore all signature code after the COMMON block, the Python module routine gets not compiled in and the load of module fails. Without a fix to this issue I am forced to stay at Numpy 1.20 but I would like to update.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0