[Mlir-commits] [mlir] [mlir:python] Fail immediately if importing an initializer module raises ImportError (PR #74595)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Dec 6 06:21:25 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Peter Hawkins (hawkinsp)
<details>
<summary>Changes</summary>
If ImportError is raised, _site_initialize will fail because 'm' will be an unbound local. Just return False in this case and fail fast.
@<!-- -->stellaraccident @<!-- -->makslevental
---
Full diff: https://github.com/llvm/llvm-project/pull/74595.diff
1 Files Affected:
- (modified) mlir/python/mlir/_mlir_libs/__init__.py (+1)
``````````diff
diff --git a/mlir/python/mlir/_mlir_libs/__init__.py b/mlir/python/mlir/_mlir_libs/__init__.py
index 32f46d24cc739..98dbbc6adf9ce 100644
--- a/mlir/python/mlir/_mlir_libs/__init__.py
+++ b/mlir/python/mlir/_mlir_libs/__init__.py
@@ -94,6 +94,7 @@ def process_initializer_module(module_name):
"encountered otherwise and the MLIR Python API may not function."
)
logger.warning(message, exc_info=True)
+ return False
logger.debug("Initializing MLIR with module: %s", module_name)
if hasattr(m, "register_dialects"):
``````````
</details>
https://github.com/llvm/llvm-project/pull/74595
More information about the Mlir-commits
mailing list