Skip to content

Commit cccb988

Browse files
committed
Fix sympy_dtype for expressions containing FieldFromPointer objects (#66)
1 parent 1146a07 commit cccb988

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

devito/symbolics/inspection.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,16 @@ def sympy_dtype(expr, base=None, default=None, smin=None):
307307
if expr is None:
308308
return default
309309

310-
# TODO: Edit/fix/update according to PR #2513
310+
def inspect_args(e, dtypes):
311+
for arg in e.args:
312+
dtype = getattr(arg, "dtype", None)
313+
if dtype is not None:
314+
dtypes.add(dtype)
315+
else:
316+
inspect_args(arg, dtypes)
317+
311318
dtypes = {base} - {None}
312-
for i in expr.args:
313-
dtype = getattr(i, 'dtype', None)
314-
if dtype:
315-
dtypes.add(dtype)
319+
inspect_args(expr, dtypes)
316320

317321
dtype = infer_dtype(dtypes)
318322

0 commit comments

Comments
 (0)