diff --git a/arraycontext/container/arithmetic.py b/arraycontext/container/arithmetic.py
index ef612fe130416f02fd5554a9ca70d116ccbae8e6..7e5da8b7d557c4ffb64d616aaf88c477ab352a5c 100644
--- a/arraycontext/container/arithmetic.py
+++ b/arraycontext/container/arithmetic.py
@@ -347,7 +347,7 @@ def with_container_arithmetic(
                 if {bool(outer_bcast_type_names)}:  # optimized away
                     if isinstance(arg2, {tup_str(outer_bcast_type_names)}):
                         return cls({bcast_init_args})
-                if {numpy_pred("arg2")}:  # optimized away
+                if {numpy_pred("arg2")}:
                     result = np.empty_like(arg2, dtype=object)
                     for i in np.ndindex(arg2.shape):
                         result[i] = {op_str.format("arg1", "arg2[i]")}
@@ -376,7 +376,7 @@ def with_container_arithmetic(
                         if {bool(outer_bcast_type_names)}:  # optimized away
                             if isinstance(arg1, {tup_str(outer_bcast_type_names)}):
                                 return cls({bcast_init_args})
-                        if {numpy_pred("arg1")}:  # optimized away
+                        if {numpy_pred("arg1")}:
                             result = np.empty_like(arg1, dtype=object)
                             for i in np.ndindex(arg1.shape):
                                 result[i] = {op_str.format("arg1[i]", "arg2")}
@@ -393,7 +393,8 @@ def with_container_arithmetic(
         # This will evaluate the module, which is all we need.
         code = gen.get().rstrip()+"\n"
         result_dict = {"_MODULE_SOURCE_CODE": code, "cls": cls}
-        exec(compile(code, "<generated code>", "exec"), result_dict)
+        exec(compile(code, f"<container arithmetic for {cls.__name__}>", "exec"),
+                result_dict)
 
         return cls
 
diff --git a/arraycontext/container/dataclass.py b/arraycontext/container/dataclass.py
index 37230e4896de980333ecb56b1c1bf7b13789c716..ccf732253b0494f3529f9730e8cb83e522fa3fe3 100644
--- a/arraycontext/container/dataclass.py
+++ b/arraycontext/container/dataclass.py
@@ -106,7 +106,8 @@ def dataclass_array_container(cls: type) -> type:
         """)
 
     exec_dict = {"cls": cls, "_MODULE_SOURCE_CODE": serialize_code}
-    exec(compile(serialize_code, "<generated code>", "exec"), exec_dict)
+    exec(compile(serialize_code, f"<container serialization for {cls.__name__}>",
+        "exec"), exec_dict)
 
     return cls