Skip to content
Snippets Groups Projects
Unverified Commit c1768f54 authored by Matthias Diener's avatar Matthias Diener Committed by GitHub
Browse files

Merge branch 'main' into pytato

parents c1b1d578 bee074ff
No related branches found
No related tags found
No related merge requests found
...@@ -330,8 +330,18 @@ def with_container_arithmetic( ...@@ -330,8 +330,18 @@ def with_container_arithmetic(
if __debug__ and _cls_has_array_context_attr: if __debug__ and _cls_has_array_context_attr:
gen(""" gen("""
if arg1.array_context is not arg2.array_context: if arg1.array_context is not arg2.array_context:
raise ValueError("array contexts of both arguments " msg = ("array contexts of both arguments "
"must match")""") "must match")
if arg1.array_context is None:
raise ValueError(msg
+ ": left operand is frozen "
"(i.e. has no array context)")
elif arg2.array_context is None:
raise ValueError(msg
+ ": right operand is frozen "
"(i.e. has no array context)")
else:
raise ValueError(msg)""")
gen(f"return cls({zip_init_args})") gen(f"return cls({zip_init_args})")
gen(f""" gen(f"""
if {bool(outer_bcast_type_names)}: # optimized away if {bool(outer_bcast_type_names)}: # optimized away
......
...@@ -654,6 +654,12 @@ def test_container_freeze_thaw(actx_factory): ...@@ -654,6 +654,12 @@ def test_container_freeze_thaw(actx_factory):
actx2 = actx.clone() actx2 = actx.clone()
ary_dof_frozen = freeze(ary_dof)
with pytest.raises(ValueError) as exc_info:
ary_dof + ary_dof_frozen
assert "frozen" in str(exc_info.value)
ary_dof_2 = thaw(freeze(ary_dof), actx2) ary_dof_2 = thaw(freeze(ary_dof), actx2)
with pytest.raises(ValueError): with pytest.raises(ValueError):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment