Skip to contentSkip to conversation

usertools: fix syntax warning in python 3.8

PATCH Applied Thomas Faivre 2 participants 2 messages Feb 12, 2020 – Feb 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usertools: fix syntax warning in python 3.8

Silent the following warning when running script with python 3.8:

Quoted 3 lines

/usr/bin/dpdk-pmdinfo:542: SyntaxWarning: "is" with a literal. Did you mean "=="?
if (autoload_path is None or autoload_path is ""):

As autoload_path can only be None or a string, directly check its bool value.

Fixes c67c9a5c646a ("tools: query binaries for HW and other support information")
---
 usertools/dpdk-pmdinfo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
usertools/dpdk-pmdinfo.py +1 -1
index 069a3bf124b2..9d5c6369a017 100755
@@ -539,7 +539,7 @@ def scan_for_autoload_pmds(dpdk_path):
         return
 
     (autoload_path, scannedfile) = readelf.search_for_autoload_path()
-    if (autoload_path is None or autoload_path is ""):
+    if not autoload_path:
         if (raw_output is False):
             print("No autoload path configured in %s" % dpdk_path)
         return
Signature · 1 line
2.23.0.tfa
#1 lore raw

12/02/2020 13:31, Thomas Faivre:

Quoted 6 lines

Silent the following warning when running script with python 3.8:

Quoted 3 lines

/usr/bin/dpdk-pmdinfo:542: SyntaxWarning: "is" with a literal. Did you mean "=="?
if (autoload_path is None or autoload_path is ""):

Quoted 7 lines

As autoload_path can only be None or a string, directly check its bool value.

Fixes c67c9a5c646a ("tools: query binaries for HW and other support information")

Applied, thanks