Skip to content

Commit

Permalink
BUG: Handle data statements in pyf files correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Apr 15, 2023
1 parent 3d58d8c commit a97f209
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion numpy/f2py/crackfortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,7 @@ def analyzeline(m, case, line):
continue
fc = 0
vtype = vars[v].get('typespec')
vdim = getdimension(vars[v])

if (vtype == 'complex'):
cmplxpat = r"\(.*?\)"
Expand All @@ -1442,7 +1443,12 @@ def analyzeline(m, case, line):
if '=' in vars[v] and not vars[v]['='] == matches[idx]:
outmess('analyzeline: changing init expression of "%s" ("%s") to "%s"\n' % (
v, vars[v]['='], matches[idx]))
vars[v]['='] = matches[idx]

if vdim is not None:
# Need to assign multiple values to one variable
vars[v]['='] = "(/{}/)".format(", ".join(matches))
else:
vars[v]['='] = matches[idx]
last_name = v
groupcache[groupcounter]['vars'] = vars
if last_name is not None:
Expand Down

0 comments on commit a97f209

Please sign in to comment.