[Mlir-commits] [mlir] [mlir][py] avoid crashing on None contexts in custom `get`s (PR #171140)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Dec 8 06:50:32 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD mlir/test/python/dialects/pdl_types.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- pdl_types.py	2025-12-08 14:41:03.000000 +0000
+++ pdl_types.py	2025-12-08 14:50:02.064280 +0000
@@ -151,13 +151,13 @@
 
 
 # CHECK-LABEL: TEST: test_type_without_context
 @run
 def test_type_without_context():
-  # Constructing a type without the surrounding ir.Context context manager
-  # should raise an exception but not crash.
-  try:
-    constructedType = pdl.ValueType.get()
-  except TypeError:
-    pass
-  else:
-    assert False, "Expected TypeError to be raised."
+    # Constructing a type without the surrounding ir.Context context manager
+    # should raise an exception but not crash.
+    try:
+        constructedType = pdl.ValueType.get()
+    except TypeError:
+        pass
+    else:
+        assert False, "Expected TypeError to be raised."

``````````

</details>


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


More information about the Mlir-commits mailing list