Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion devito/types/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def _subs(self, old, new, **hints):
devito subclasses of sympy types are quite strict.
"""
try:
if old.name == self.name:
if old.is_Symbol and old.name == self.name:
return new
except AttributeError:
pass
Expand Down
10 changes: 10 additions & 0 deletions tests/test_symbolics.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,16 @@ def test_safeinv():
assert 'SAFEINV' in str(op1)
assert 'SAFEINV' in str(op2)

# Ensure .subs leaves the caller unchanged if no substitutions occur.
# We used to have a bug where passing SafeInv to .subs would result
# in the construction of weird, nonsensical objects due to the _subs
# stub in types.AbstractSymbol
f = Function(name='f', grid=grid)
ui = u1.indexify()
safeinv = SafeInv(ui, ui)
v = ui._subs(safeinv, f.indexify())
assert str(v) == 'u[x, y]'


def test_def_function():
foo0 = DefFunction('foo', arguments=['a', 'b'], template=['int'])
Expand Down
Loading