[Mlir-commits] [mlir] babad7c - [mlir][python] Use a named object

Adrian Kuegel llvmlistbot at llvm.org
Fri Jan 7 04:24:34 PST 2022


Author: Adrian Kuegel
Date: 2022-01-07T13:22:32+01:00
New Revision: babad7c566843c6816cd9bc65e3056e512093dbf

URL: https://github.com/llvm/llvm-project/commit/babad7c566843c6816cd9bc65e3056e512093dbf
DIFF: https://github.com/llvm/llvm-project/commit/babad7c566843c6816cd9bc65e3056e512093dbf.diff

LOG: [mlir][python] Use a named object

Currently, the object would be immediately destroyed after creation.
Found by ClangTidy bugprone-unused-raii.

Added: 
    

Modified: 
    mlir/lib/Bindings/Python/PybindUtils.h

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bindings/Python/PybindUtils.h b/mlir/lib/Bindings/Python/PybindUtils.h
index 2fdcf695b09bd..457d8090c087c 100644
--- a/mlir/lib/Bindings/Python/PybindUtils.h
+++ b/mlir/lib/Bindings/Python/PybindUtils.h
@@ -140,7 +140,7 @@ class PyFileAccumulator {
 
   MlirStringCallback getCallback() {
     return [](MlirStringRef part, void *userData) {
-      pybind11::gil_scoped_acquire();
+      pybind11::gil_scoped_acquire acquire;
       PyFileAccumulator *accum = static_cast<PyFileAccumulator *>(userData);
       if (accum->binary) {
         // Note: Still has to copy and not avoidable with this API.


        


More information about the Mlir-commits mailing list