Skip to content

Commit 531a694

Browse files
committed
BUG: Handle multi-module files and common better
Fixes numpygh-25186 numpygh-25337 numpygh-27622
1 parent 22bbc2c commit 531a694

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

numpy/f2py/auxfuncs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
'isunsigned_long_long', 'isunsigned_long_longarray', 'isunsigned_short',
4444
'isunsigned_shortarray', 'l_and', 'l_not', 'l_or', 'outmess', 'replace',
4545
'show', 'stripcomma', 'throw_error', 'isattr_value', 'getuseblocks',
46-
'process_f2cmap_dict'
46+
'process_f2cmap_dict', 'containscommon'
4747
]
4848

4949

numpy/f2py/f90mod_rules.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ def dadd(line, s=doc):
9797

9898
usenames = getuseblocks(pymod)
9999
for m in findf90modules(pymod):
100-
contains_functions_or_subroutines = any(
101-
item for item in m["body"] if item["block"] in ["function", "subroutine"]
102-
)
103100
sargs, fargs, efargs, modobjs, notvars, onlyvars = [], [], [], [], [
104101
m['name']], []
105102
sargsp = []
@@ -120,8 +117,9 @@ def dadd(line, s=doc):
120117
outmess(f"\t\t\tSkipping {m['name']} since there are no public vars/func in this module...\n")
121118
continue
122119

123-
if m['name'] in usenames and not contains_functions_or_subroutines:
124-
outmess(f"\t\t\tSkipping {m['name']} since it is in 'use'...\n")
120+
# gh-25186
121+
if m['name'] in usenames and containscommon(m):
122+
outmess(f"\t\t\tSkipping {m['name']} since it is in 'use' and contains a common block...\n")
125123
continue
126124
if onlyvars:
127125
outmess('\t\t Variables: %s\n' % (' '.join(onlyvars)))

0 commit comments

Comments
 (0)