Skip to content

BUG: F2PY: module name not written to signature file (regression) #25263

Description

@jmrohwer

Describe the issue:

With the latest development version, the module information is not written to the signature file (*.pyf) when using f2py -h. This causes errors further down the line. It was working in v.1.26.

Reproduce the code example:

**hi.f**
      SUBROUTINE HELLO()
      PRINT*,"Hello from fortran"
      END

>>> python -m numpy.f2py -m hi -h hi.pyf hi.f

Error message:

No error message, but the hi.pyf files differ:

** hi.pyf ** (generated with numpy 2.0.0.dev)
!    -*- f90 -*-
! Note: the context of this file is case sensitive.

subroutine hello ! in hi.f
end subroutine hello

! This file was auto-generated with f2py (version:2.0.0.dev0+git20231124.94bc564).
! See:
! https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e

** hi.pyf ** (generated with numpy 1.26)
!    -*- f90 -*-
! Note: the context of this file is case sensitive.

python module hi ! in 
    interface  ! in :hi
        subroutine hello ! in :hi:hi.f
        end subroutine hello
    end interface 
end python module hi

! This file was auto-generated with f2py (version:1.26.1).
! See:
! https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e

Runtime information:

>>> numpy.show_runtime()
[{'numpy_version': '2.0.0.dev0+git20231124.94bc564',
  'python': '3.12.0 (main, Oct 21 2023, 12:40:24) [GCC 13.2.1 20230801]',
  'uname': uname_result(system='Linux', node='jr-xps13', release='6.1.63-1-MANJARO', version='#1 SMP PREEMPT_DYNAMIC Mon Nov 20 12:57:36 UTC 2023', machine='x86_64')},
 {'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
                      'found': ['SSSE3',
                                'SSE41',
                                'POPCNT',
                                'SSE42',
                                'AVX',
                                'F16C',
                                'FMA3',
                                'AVX2',
                                'AVX512F',
                                'AVX512CD',
                                'AVX512_SKX',
                                'AVX512_CLX',
                                'AVX512_CNL',
                                'AVX512_ICL'],
                      'not_found': ['AVX512_KNL', 'AVX512_KNM', 'AVX512_SPR']}},
 {'filepath': '/usr/lib/libgomp.so.1.0.0',
  'internal_api': 'openmp',
  'num_threads': 8,
  'prefix': 'libgomp',
  'user_api': 'openmp',
  'version': None}]

Context for the issue:

Building Fortran extension modules.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions