From bd24fd9b713b84c1174cf2e3cc239eb3a371bf77 Mon Sep 17 00:00:00 2001 From: dinglimin Date: Wed, 29 Jun 2022 10:46:27 +0800 Subject: [PATCH] avoid "is" with a literal Python 3.8 warnings Identity operators is and is not check if the same object is on both sides, i.e. a is b returns True if id(a) == id(b). Integers, bytes, floats, strings, frozensets and tuples should not be compared with identity operators because the result may not be as expected. If you need to compare these types you should use instead equality operators == or !=. Signed-off-by: dinglimin --- scripts/tracetool/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 6fca674936..ad01e8b03e 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -453,12 +453,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): -- Gitee