Skip to content

Commit

Permalink
BUG: Simplify and fix gh-23276
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Apr 15, 2023
1 parent 1d02e2b commit e12392d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions numpy/f2py/crackfortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -1417,10 +1417,10 @@ def analyzeline(m, case, line):
outmess(
'analyzeline: implied-DO list "%s" is not supported. Skipping.\n' % l[0])
continue
i = 0
j = 0
llen = len(l[1])
for v in rmbadname([x.strip() for x in markoutercomma(l[0]).split('@,@')]):
for idx, v in enumerate(rmbadname(
[x.strip() for x in markoutercomma(l[0]).split('@,@')])
):
if v[0] == '(':
outmess(
'analyzeline: implied-DO list "%s" is not supported. Skipping.\n' % v)
Expand All @@ -1429,18 +1429,20 @@ def analyzeline(m, case, line):
# wrapping.
continue
fc = 0
while (i < llen) and (fc or not l[1][i] == ','):
if l[1][i] == "'":
fc = not fc
i = i + 1
i = i + 1
vtype = vars[v].get('typespec')

if (vtype == 'complex'):
cmplxpat = r"\(.*?\)"
matches = re.findall(cmplxpat, l[1])
else:
matches = l[1].split(',')

if v not in vars:
vars[v] = {}
if '=' in vars[v] and not vars[v]['='] == l[1][j:i - 1]:
if '=' in vars[v] and not vars[v]['='] == matches[idx]:
outmess('analyzeline: changing init expression of "%s" ("%s") to "%s"\n' % (
v, vars[v]['='], l[1][j:i - 1]))
vars[v]['='] = l[1][j:i - 1]
j = i
v, vars[v]['='], matches[idx]))
vars[v]['='] = matches[idx]
last_name = v
groupcache[groupcounter]['vars'] = vars
if last_name is not None:
Expand Down

0 comments on commit e12392d

Please sign in to comment.