summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2012-12-12 04:18:50 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2012-12-12 04:22:44 +0100
commit9914968a94481f84ad0d9cfcb1f5e85334626042 (patch)
treeea53ae404b0ef4e9a7a9c34981811f4ba720dbdc /kconfiglib.py
parent72a904f42156729efc0be5b1bba348e41097199a (diff)
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.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py14
1 files changed, 9 insertions, 5 deletions
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()