Skip to content

Commit 53ea762

Browse files
committed
misc: Fix sympy_dtype since merge with main
1 parent b9ef3a5 commit 53ea762

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

devito/symbolics/inspection.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -315,20 +315,16 @@ def sympy_dtype(expr, base=None, default=None, smin=None):
315315
if expr is None:
316316
return default
317317

318-
dtypes = set()
319-
320-
def inspect(e):
321-
try:
322-
dtype = e.dtype
323-
except AttributeError:
324-
dtype = None
325-
if dtype is not None:
326-
dtypes.add(dtype)
327-
else:
328-
for arg in e.args:
329-
inspect(arg)
318+
def inspect_args(e):
319+
for arg in e.args:
320+
dtype = getattr(arg, "dtype", None)
321+
if dtype is not None:
322+
dtypes.add(dtype)
323+
else:
324+
inspect_args(arg)
330325

331-
inspect(expr)
326+
dtypes = set()
327+
inspect_args(expr)
332328

333329
if not dtypes or not np.issubdtype(base, np.complexfloating):
334330
dtypes.update({base} - {None})

0 commit comments

Comments
 (0)