tracetool: fix usage of try_import()

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>
This commit is contained in:
Paolo Bonzini
2025-10-01 11:22:07 -04:00
committed by Stefan Hajnoczi
parent 29b77c1a2d
commit 50873504dc
2 changed files with 2 additions and 2 deletions
+1 -1
View 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:
+1 -1
View 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):