8000 BUG: f2py failing to parse fix-form Fortran · Issue #28749 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
BUG: f2py failing to parse fix-form Fortran #28749
Closed as not planned
Closed as not planned
@ClarkMyWords

Description

@ClarkMyWords

Describe the issue:

I'm trying to compile a fix-form Fortran file with f2py. In the past I have had this working, but apparently some recent change has broken this? Or perhaps I'm doing something wrong.

I'm including a very simple test file on which it is also failing. I'm getting the same type of error on a much larger file. It seems to me like it doesn't like the fix-form spacing or something, but the file hasn't changed since I previously had it working with f2py.

Reproduce the code example:

Example Fortran File where I'm having the issue:

TEST.f

      subroutine test ()

      implicit none

      character(8) name
      name = 'TEST'

      return
      end

Then running:

f2py -h TEST.pyf TEST.f -m TEST --overwrite-signature --verbose

My actual program is an Abaqus UMAT, so it also only implements subroutines and no main.

Error message:

Reading fortran codes...
	Reading file 'TEST.f' (format:fix,strict)
analyzeline: Creating module block 'TEST'
analyzeline: Creating additional interface block (groupcounter=2).
Line #7 in TEST.f:"      name = 'TEST' "
	crackline:3: No pattern for line
Line #8 in TEST.f:"      return "
	crackline:3: No pattern for line
Post-processing...
	Block: TEST
			Block: test
In: :TEST:TEST.f:test
buildimplicitrules: no implicit rules for routine 'test'.
In: :TEST:TEST.f:test
buildimplicitrules: no implicit rules for routine 'test'.
Applying post-processing hooks...
  character_backward_compatibility_hook
Post-processing (stage 2)...
Saving signatures to file "./TEST.pyf"
Stopping. Edit the signature file and then run f2py on the signature file: f2py ./TEST.pyf

Python and NumPy Versions:

2.2.4
3.13.0 (main, Oct 16 2024, 03:23:02) [Clang 18.1.8 ]

Runtime Environment:

[{'numpy_version': '2.2.4',
'python': '3.13.0 (main, Oct 16 2024, 03:23:02) [Clang 18.1.8 ]',
'uname': uname_result(system='Linux', node='clarklaptop', release='6.14.2-arch1-1', version='#1 SMP PREEMPT_DYNAMIC Thu, 10 Apr 2025 18:43:59 +0000', 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']}},
{'architecture': 'SkylakeX',
'filepath': '/home/clark/Research/SinglePointSimulator/.venv/lib/python3.13/site-packages/numpy.libs/libscipy_openblas64_-6bb31eeb.so',
'internal_api': 'openblas',
'num_threads': 16,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.28'}]

Context for the issue:

I think it's very possible that I'm just formatting something incorrectly, but I need a second set of eyes to look at this. I have run into a similar issue before, but I was using non-standard Fortran extensions, and now I have fixed that issue, but this seems to persist.

Happy to include a longer traceback of what's failing with my actual script, but it's the same "crackline:3; No pattern for line"

TIA for any and all help!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0