8000 BUG: Fix data stmt handling for complex values in f2py by HaoZeke · Pull Request #23282 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix data stmt handling for complex values in f2py #23282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
BUG: Handle data statements in pyf files correctly
  • Loading branch information
HaoZeke committed Apr 15, 2023
commit a97f209fe33fa5611f9d286a86e70fda230e6784
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