Skip to content

Commit 3c94e46

Browse files
committed
api: silence non-Expr warning for tensor (e.g staggering/name/..)
1 parent ecc53dd commit 3c94e46

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

devito/types/basic.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import abc
22
import inspect
3+
import warnings
34
from contextlib import suppress
45
from ctypes import POINTER, Structure, _Pointer, c_char, c_char_p
56
from functools import cached_property, reduce
@@ -9,6 +10,7 @@
910
import sympy
1011
from sympy.core.assumptions import _assume_rules
1112
from sympy.core.decorators import call_highest_priority
13+
from sympy.utilities.exceptions import SymPyDeprecationWarning
1214

1315
from devito.data import default_allocator
1416
from devito.parameters import configuration
@@ -1533,10 +1535,20 @@ def _sympify(self, arg):
15331535
# This is used internally by sympy to process arguments at rebuilt. And since
15341536
# some of our properties are non-sympyfiable we need to have a fallback
15351537
try:
1536-
return super()._sympify(arg)
1537-
except sympy.SympifyError:
1538+
# Pure sympy object
1539+
return arg._sympy_()
1540+
except AttributeError:
15381541
return arg
15391542

1543+
@classmethod
1544+
def _eval_from_dok(cls, rows, cols, dok):
1545+
with warnings.catch_warnings():
1546+
warnings.filterwarnings(
1547+
"ignore",
1548+
category=SymPyDeprecationWarning
1549+
)
1550+
return super()._eval_from_dok(rows, cols, dok)
1551+
15401552
@property
15411553
def grid(self):
15421554
"""

0 commit comments

Comments
 (0)