[Mlir-commits] [mlir] [mlir] Python: Parse ModuleOp from file path (PR #126572)
Mehdi Amini
llvmlistbot at llvm.org
Tue Feb 11 03:19:42 PST 2025
================
@@ -3049,6 +3052,21 @@ void mlir::python::populateIRCore(nb::module_ &m) {
},
nb::arg("asm"), nb::arg("context").none() = nb::none(),
kModuleParseDocstring)
+#if __has_include(<filesystem>)
+ .def_static(
+ "parse",
+ [](const std::filesystem::path &path,
+ DefaultingPyMlirContext context) {
----------------
joker-eph wrote:
Other places in the python bindings are using either `std::string` for filepath, or a "streaming" idiom with a "file object" (and our own `PyFileAccumulator`), I would just align with either of these patterns.
https://github.com/llvm/llvm-project/blob/main/mlir/lib/Bindings/Python/ExecutionEngineModule.cpp#L77
https://github.com/llvm/llvm-project/blob/main/mlir/lib/Bindings/Python/IRCore.cpp#L1321-L1336
https://github.com/llvm/llvm-project/pull/126572
More information about the Mlir-commits
mailing list