Previously, the expressions given to the `-m` and `-k` options were evaluated with `eval`. This causes a few issues: - Python keywords cannot be used. - Constants like numbers, None, True, False are not handled correctly. - Various syntax like numeric operators and `X if Y else Z` is supported unintentionally. - `eval()` is somewhat dangerous for arbitrary input. - Can fail in many ways so requires `except Exception`. The format we want to support is quite simple, so change to a custom parser. This fixes the issues above, and gives us full control of the format, so can be documented comprehensively and even be extended in the future if we wish.
4 lines
285 B
ReStructuredText
4 lines
285 B
ReStructuredText
Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's ``eval()``.
|
|
The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against.
|
|
Python constants, keywords or other operators are no longer evaluated differently.
|