Check invalid operations for -k

`KeywordMapping` returns a bool on lookup which when passed to eval
fail on certain operations such as index access and attribute access.
We catch all exceptions and raise a `UsageError`.
This commit is contained in:
gdhameeja
2020-03-03 12:45:32 +05:30
parent bd7e33277b
commit 599bf075db

View File

@@ -106,5 +106,5 @@ def matchkeyword(colitem, keywordexpr):
)
try:
return eval(keywordexpr, {}, mapping)
except SyntaxError:
except Exception:
raise UsageError("Wrong expression passed to '-k': {}".format(keywordexpr))