Skip to content

Commit 2fa5517

Browse files
Merge pull request #2889 from devitocodes/hotfix-check-array
Hotfix check_array
2 parents 1614555 + b255cca commit 2fa5517

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,11 @@ def check_array(array, exp_halo, exp_shape, rotate=False):
467467

468468
shape = []
469469
for i in array.symbolic_shape:
470-
if i.is_Number or i.is_Symbol:
471-
shape.append(i)
472-
else:
473-
assert i.is_Add
470+
if i.is_Add:
471+
# Ensure it's a plain sympy.Add and not a subclass
474472
shape.append(Add(*i.args))
473+
else:
474+
shape.append(i)
475475

476476
if rotate:
477477
exp_shape = (sum(exp_halo[0]) + 1,) + tuple(exp_shape[1:])

devito/symbolics/extended_sympy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,10 @@ def __new__(cls, value, step, **kwargs):
634634
value = sympify(value)
635635
step = sympify(step)
636636

637-
if step < 1:
638-
raise ValueError("Cannot round up with negative `step`")
639637
if not is_integer(step):
640638
raise ValueError("`step` must be an integer")
639+
if step < 1:
640+
raise ValueError("Cannot round up with negative `step`")
641641

642642
if value.is_number and step.is_number:
643643
remainder = value % step

devito/types/basic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,8 @@ def __padding_setup_smart__(self, **kwargs):
930930
else:
931931
from devito.symbolics import RoundUp # noqa
932932
v = RoundUp(snp, mmts) - snp
933+
if v.is_Integer:
934+
v = int(v)
933935

934936
dpadding = (0, v)
935937
padding = [(0, 0)]*self.ndim

0 commit comments

Comments
 (0)