Skip to contentSkip to conversation

parser: make contains_tag ignore non-str fields

PATCH New Yi Fan Yu 1 participant 1 message Feb 12, 2021

lore
Share & tools
lore

Yi Fan Yu

author
#0 lore raw

PATCH 1/1 parser: make contains_tag ignore non-str fields

if MACHINE is set to False (in a selftest build), contains_tags should skip that field instead of searching for the character '<'.

[YOCTO #14208]

---
 Post/parser.py | 4 ++++
 1 file changed, 4 insertions(+)
Post/parser.py +4 -0
index ed65d4f..f54482a 100644
@@ -21,10 +21,14 @@ class Parser:
 
     # returns true if the values contain '<' char
     # Ignore the failures field (which is an array anyway)
+    # Ignore any non-str fields too [YOCTO #14208]
     def contains_tags (self, data):
         for key,val in data.items():
             if key == 'failures':
                 continue
+            
+            if not isinstance(val, str):
+                continue
 
             if '<' in val:
                 return True
Signature · 1 line
2.25.1