From 9914968a94481f84ad0d9cfcb1f5e85334626042 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 12 Dec 2012 04:18:50 +0100 Subject: Always count non-bool/tristate symbols as 'n' in tristate context. Previously a string symbol that happened to have the value "y" would count as "y" in tristate context, which is incorrect. --- kconfiglib.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 88003f9..66e153c 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1421,10 +1421,15 @@ error, and you should e-mail kconfiglib@gmail.com. if expr is None: return "y" - if isinstance(expr, (str, Symbol)): - val = self._get_str_value(expr) - # Expressions always have a tristate value - return val if val in ("y", "m") else "n" + if isinstance(expr, Symbol): + # Non-bool/tristate symbols are always "n" in a tristate sense, + # regardless of their value + if expr.type != BOOL and expr.type != TRISTATE: + return "n" + return expr.get_value() + + if isinstance(expr, str): + return expr if (expr == "y" or expr == "m") else "n" first_expr = expr[0] @@ -1484,7 +1489,6 @@ error, and you should e-mail kconfiglib@gmail.com. def _get_str_value(self, obj): if isinstance(obj, str): return obj - # obj is a Symbol return obj.get_value() -- cgit v1.2.3