8000 BUG: Handle data statements in pyf files correctly · numpy/numpy@a97f209 · GitHub
[go: up one dir, main page]

Skip to content

Commit a97f209

Browse files
committed
BUG: Handle data statements in pyf files correctly
1 parent 3d58d8c commit a97f209

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

numpy/f2py/crackfortran.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,7 @@ def analyzeline(m, case, line):
14301430
continue
14311431
fc = 0
14321432
vtype = vars[v].get('typespec')
1433+
vdim = getdimension(vars[v])
14331434

14341435
if (vtype == 'complex'):
14351436
cmplxpat = r"\(.*?\)"
@@ -1442,7 +1443,12 @@ def analyzeline(m, case, line):
14421443
if '=' in vars[v] and not vars[v]['='] == matches[idx]:
14431444
outmess('analyzeline: changing init expression of "%s" ("%s") to "%s"\n' % (
14441445
v, vars[v]['='], matches[idx]))
1445-
vars[v]['='] = matches[idx]
1446+
1447+
if vdim is not None:
1448+
# Need to assign multiple values to one variable
1449+
vars[v]['='] = "(/{}/)".format(", ".join(matches))
1450+
else:
1451+
vars[v]['='] = matches[idx]
14461452
last_name = v
14471453
groupcache[groupcounter]['vars'] = vars
14481454
if last_name is not None:

0 commit comments

Comments
 (0)
0