Content-Length: 241402 | pFad | http://github.com/numpy/numpy/issues/29037

74 BUG: f2py fails to compile modules with derived types after changes in 2.2.0 · Issue #29037 · numpy/numpy · GitHub
Skip to content

BUG: f2py fails to compile modules with derived types after changes in 2.2.0 #29037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zoghbi-a opened this issue May 22, 2025 · 1 comment · Fixed by #29040
Closed

BUG: f2py fails to compile modules with derived types after changes in 2.2.0 #29037

zoghbi-a opened this issue May 22, 2025 · 1 comment · Fixed by #29040
Labels

Comments

@zoghbi-a
Copy link
Contributor

zoghbi-a commented May 22, 2025

Describe the issue:

Prior to changes in 2.2.0, the following works:

python -m numpy.f2py -m mod1 dummy.f90

with dummy.f90 having:

module mod1
    implicit none 
    type :: master_data
    integer :: idat
    end type master_data
    type(master_data) :: masterdata
end module mod1


subroutine simple_subroutine(arg)
  use mod1
  integer, intent(inout) :: arg
  arg = arg * 5
end subroutine simple_subroutine

It worked before 2.2.0, since the module is in a use statement, it is skipped.

With changes in 2.2.0, only modules with a common block are skipped, and this case is not. Running the above fails when trying to interpret the derived type master_data with the error below:

Reproduce the code example:

python -m numpy.f2py -m mod1 dummy.f90

Error message:

getctype: No C-type found in "{'typespec': 'type', 'typename': 'master_data'}", assuming void.
Traceback (most recent call last):
  File "{path}/bin/f2py", line 8, in <module>
    sys.exit(main())
             ^^^^^^

File "{path}/lib/python3.12/site-packages/numpy/f2py/f2py2e.py", line 783, in main
    run_main(sys.argv[1:])
  File "{{path}}/lib/python3.12/site-packages/numpy/f2py/f2py2e.py", line 507, in run_main
    ret = buildmodules(postlist)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "{{path}}/lib/python3.12/site-packages/numpy/f2py/f2py2e.py", line 412, in buildmodules
    dict_append(ret[name], rules.buildmodule(module, um))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "{{path}}/lib/python3.12/site-packages/numpy/f2py/rules.py", line 1317, in buildmodule
    mr, wrap = f90mod_rules.buildhooks(m)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "{{path}}/lib/python3.12/site-packages/numpy/f2py/f90mod_rules.py", line 149, in buildhooks
    at = capi_maps.c2capi_map[ct]
         ~~~~~~~~~~~~~~~~~~~~^^^^
KeyError: 'void'

Python and NumPy Versions:

2.2.0 (and above)
3.12.10 | packaged by conda-forge | (main, Apr 10 2025, 22:21:13) [GCC 13.3.0]

Runtime Environment:

[{'numpy_version': '2.2.0',
'python': '3.12.10 | packaged by conda-forge | (main, Apr 10 2025, 22:21:13) '
'[GCC 13.3.0]',
'uname': uname_result(system='Linux', node='gs66', release='5.15.0-303.171.5.2.1.el8uek.x86_64', version='#2 SMP Mon Dec 23 14:37:50 PST 2024', 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']}}]

Context for the issue:

Changes to f2py in 2.2.0 broke code that used to compile before

@charris
Copy link
Member

charris commented May 22, 2025

@HaoZeke Ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/numpy/numpy/issues/29037

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy