From: Binghua Guan Date: Sat, 30 Jun 2018 09:53:34 +0000 (+0800) Subject: oe.types.boolean: treat None as False X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~17453 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3048e9fa0df6b1edf79bd1723e0fc022c3332af1;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git oe.types.boolean: treat None as False It is better to return False for None. E.g. checking an undefined variable returned d.getVar(). Signed-off-by: Binghua Guan Signed-off-by: Ross Burton --- diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py index f778c1de689..f4017130df6 100644 --- a/meta/lib/oe/types.py +++ b/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