]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
trace: avoid "is" with a literal Python 3.8 warnings
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 10 Oct 2019 12:21:54 +0000 (13:21 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 15 Oct 2019 08:47:16 +0000 (09:47 +0100)
The following statement produces a SyntaxWarning with Python 3.8:

  if len(format) is 0:
  scripts/tracetool/__init__.py:459: SyntaxWarning: "is" with a literal. Did you mean "=="?

Use the conventional len(x) == 0 syntax instead.

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191010122154.10553-1-stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scripts/tracetool/__init__.py

index 04279fa62e4f36bd2892832969e437b104eabf65..44c118bc2ab078e051bbf895715b4bc426e626e4 100644 (file)
@@ -456,12 +456,12 @@ def generate(events, group, format, backends,
     import tracetool
 
     format = str(format)
-    if len(format) is 0:
+    if len(format) == 0:
         raise TracetoolError("format not set")
     if not tracetool.format.exists(format):
         raise TracetoolError("unknown format: %s" % format)
 
-    if len(backends) is 0:
+    if len(backends) == 0:
         raise TracetoolError("no backends specified")
     for backend in backends:
         if not tracetool.backend.exists(backend):