]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tracetool: fix usage of try_import()
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 29 Sep 2025 15:49:23 +0000 (17:49 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 1 Oct 2025 15:22:07 +0000 (11:22 -0400)
try_import returns a tuple of a boolean and the requested module or attribute.
exists() functions return tracetool.try_import("tracetool.format." + name)[1]
but they should return the boolean value instead.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20250929154938.594389-2-pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scripts/tracetool/backend/__init__.py
scripts/tracetool/format/__init__.py

index 7bfcc86cc5366863a6842dea109e96fccc0eb099..6c6344deddb241b85bbf045a7684db48b5c6afbd 100644 (file)
@@ -94,7 +94,7 @@ def exists(name):
     if name == "nop":
         return True
     name = name.replace("-", "_")
-    return tracetool.try_import("tracetool.backend." + name)[1]
+    return tracetool.try_import("tracetool.backend." + name)[0]
 
 
 class Wrapper:
index 2dc46f3dd93e4d9fdd58a3cfa77efe6100a9adbe..042fe7d103cd6f8f1b6c81fb47ae09d4065e7868 100644 (file)
@@ -70,7 +70,7 @@ def exists(name):
     if len(name) == 0:
         return False
     name = name.replace("-", "_")
-    return tracetool.try_import("tracetool.format." + name)[1]
+    return tracetool.try_import("tracetool.format." + name)[0]
 
 
 def generate(events, format, backend, group):