Skip to content

Commit

Permalink
trace: avoid "is" with a literal Python 3.8 warnings
Browse files Browse the repository at this point in the history
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é <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
stefanhaRH authored and Andrew Fasano committed Nov 13, 2020
1 parent 1fa8633 commit 1bd90bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/tracetool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,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):
Expand Down

0 comments on commit 1bd90bb

Please sign in to comment.