[Mlir-commits] [mlir] [mlir][python] add type wrappers (PR #71218)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Tue Nov 14 06:39:38 PST 2023


================
@@ -772,3 +773,94 @@ def testCustomTypeTypeCaster():
         print(t)
         # CHECK: OperationType(!transform.op<"foo.bar">)
         print(repr(t))
+
+
+# CHECK-LABEL: TEST: testTypeWrappers
+ at run
+def testTypeWrappers():
+    try:
+        from mlir.types import i32
+    except RuntimeError as e:
+        assert e.args[0].startswith(
+            "An MLIR function requires a Context but none was provided"
+        )
----------------
ftynse wrote:

Could we have a slightly better error message here? Specifically something suggesting that these attributes/functions must only be used within `Context()` context manager? 

https://github.com/llvm/llvm-project/pull/71218


More information about the Mlir-commits mailing list