Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using Python's eval() for -m and -k #7122

Merged
merged 1 commit into from
May 7, 2020

Commits on May 1, 2020

  1. Stop using Python's eval() for -m and -k

    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.
    bluetech committed May 1, 2020
    Configuration menu
    Copy the full SHA
    a718ad6 View commit details
    Browse the repository at this point in the history