Parcourir la source

oe.types.boolean: treat None as False

It is better to return False for None. E.g. checking an undefined
variable returned d.getVar().

(From OE-Core rev: 3048e9fa0df6b1edf79bd1723e0fc022c3332af1)

Signed-off-by: Binghua Guan <freebendy@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Binghua Guan il y a 7 ans
Parent
commit
0996eecb21
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      meta/lib/oe/types.py

+ 4 - 1
meta/lib/oe/types.py

@@ -103,8 +103,11 @@ def boolean(value):
     """OpenEmbedded 'boolean' type
 
     Valid values for true: 'yes', 'y', 'true', 't', '1'
-    Valid values for false: 'no', 'n', 'false', 'f', '0'
+    Valid values for false: 'no', 'n', 'false', 'f', '0', None
     """
+    if value is None:
+        return False
+
     if isinstance(value, bool):
         return value