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:
parent
bd7e33277b
commit
599bf075db
|
@ -106,5 +106,5 @@ def matchkeyword(colitem, keywordexpr):
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
return eval(keywordexpr, {}, mapping)
|
return eval(keywordexpr, {}, mapping)
|
||||||
except SyntaxError:
|
except Exception:
|
||||||
raise UsageError("Wrong expression passed to '-k': {}".format(keywordexpr))
|
raise UsageError("Wrong expression passed to '-k': {}".format(keywordexpr))
|
||||||
|
|
Loading…
Reference in New Issue