diff mbox series

codeparser: replace deprecated ast.Str and 's'

Message ID 20231016183346.4343-1-chris.laplante@agilent.com
State Accepted, archived
Commit 5419a8473d6d4cd1d01537de68ad8d72cf5be0b2
Headers show
Series codeparser: replace deprecated ast.Str and 's' | expand

Commit Message

chris.laplante@agilent.com Oct. 16, 2023, 6:33 p.m. UTC
From: Chris Laplante <chris.laplante@agilent.com>

These have been deprecated since 3.8

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/codeparser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/codeparser.py b/lib/bb/codeparser.py
index eabeda591a..cb068844bb 100644
--- a/lib/bb/codeparser.py
+++ b/lib/bb/codeparser.py
@@ -255,8 +255,8 @@  class PythonParser():
     def visit_Call(self, node):
         name = self.called_node_name(node.func)
         if name and (name.endswith(self.getvars) or name.endswith(self.getvarflags) or name in self.containsfuncs or name in self.containsanyfuncs):
-            if isinstance(node.args[0], ast.Str):
-                varname = node.args[0].s
+            if isinstance(node.args[0], ast.Constant) and isinstance(node.args[0].value, str):
+                varname = node.args[0].value
                 if name in self.containsfuncs and isinstance(node.args[1], ast.Str):
                     if varname not in self.contains:
                         self.contains[varname] = set()