summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2015-06-15 18:54:55 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2015-06-15 18:54:55 +0200
commit2f7dce28078c8b65a928c9d757d48673ca5e3df4 (patch)
tree65af9bb65304d340906219e8325e3a69f78b4c41
parenta3b1f596e68e7a1e896bfb68daa3a52edf2e5396 (diff)
Move 'expr is None' check up to _eval_expr().
None should never appear as a subexpression.
-rw-r--r--kconfiglib.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index bc8e7e5..a6d112c 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -1381,6 +1381,11 @@ class Config(object):
def _eval_expr(self, expr):
"""Evaluates an expression and returns one of the tristate values "n",
"m" or "y"."""
+
+ # Handles e.g. an "x if y" condition where the "if y" part is missing.
+ if expr is None:
+ return "y"
+
res = self._eval_expr_2(expr)
if res == "m":
@@ -1395,9 +1400,6 @@ class Config(object):
return res
def _eval_expr_2(self, expr):
- if expr is None:
- return "y"
-
if isinstance(expr, Symbol):
# Non-bool/tristate symbols are always "n" in a tristate sense,
# regardless of their value