summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPearu Peterson <pearu.peterson@gmail.com>2021-01-18 15:24:24 +0200
committerPearu Peterson <pearu.peterson@gmail.com>2021-01-18 15:24:24 +0200
commit36439a7d0e0896703823c68d116b9900e49df998 (patch)
tree9b76f24d979ed039edae94b1245068a13381ac11
parenta2f6fbb5b068a4e589bd95b8774d3624062c0995 (diff)
downloadnumpy-36439a7d0e0896703823c68d116b9900e49df998.tar.gz
BUG: f2py specific __user__ modules should not be used in Fortran sources to be compiled. Closes #17797.
-rw-r--r--numpy/f2py/func2subr.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/f2py/func2subr.py b/numpy/f2py/func2subr.py
index e9976f43c..21d4c009c 100644
--- a/numpy/f2py/func2subr.py
+++ b/numpy/f2py/func2subr.py
@@ -130,7 +130,7 @@ def createfuncwrapper(rout, signature=0):
l = l + ', ' + fortranname
if need_interface:
for line in rout['saved_interface'].split('\n'):
- if line.lstrip().startswith('use '):
+ if line.lstrip().startswith('use ') and '__user__' not in line:
add(line)
args = args[1:]
@@ -222,7 +222,7 @@ def createsubrwrapper(rout, signature=0):
if need_interface:
for line in rout['saved_interface'].split('\n'):
- if line.lstrip().startswith('use '):
+ if line.lstrip().startswith('use ') and '__user__' not in line:
add(line)
dumped_args = []
@@ -247,7 +247,10 @@ def createsubrwrapper(rout, signature=0):
pass
else:
add('interface')
- add(rout['saved_interface'].lstrip())
+ for line in rout['saved_interface'].split('\n'):
+ if line.lstrip().startswith('use ') and '__user__' in line:
+ continue
+ add(line)
add('end interface')
sargs = ', '.join([a for a in args if a not in extra_args])