script: modify security-check.py to use "==" instead of "is" for literal comparison #20346

pull tylerchambers wants to merge 1 commits into bitcoin:master from tylerchambers:literal-comparison-update changing 2 files +2 −1
  1. tylerchambers commented at 9:42 PM on November 8, 2020: contributor

    In Python 3.8+ literal comparisons using "is" instead of "==" produce a SyntaxWarning source.

    I checked the entire devtools directory, this seems to be the only occurrence.

    This is a small fix, but removes the SyntaxWarning. Fixes: #20338

  2. fanquake added the label Scripts and tools on Nov 8, 2020
  3. practicalswift commented at 10:15 PM on November 8, 2020: contributor

    Concept ACK

    Very nice first-time contribution @tylerchambers! Warm welcome as a contributor! ❤️

    To guard against this type of error entering our code base: consider enabling the flake8 check F632 in our lint-python.sh linter. That check would have caught this issue, but we're currently not opt-ing in to it :)

    $ flake8 --select F632 contrib/devtools/security-check.py
    contrib/devtools/security-check.py:65:24: F632 use ==/!= to compare str, bytes, and int literals
    
  4. tylerchambers commented at 10:33 PM on November 8, 2020: contributor

    thanks @practicalswift ! done.

  5. practicalswift commented at 10:58 PM on November 8, 2020: contributor

    ACK 5eea822eb37596c7f9ea73c62f8019414cfa281b: patch looks correct

  6. hebasto approved
  7. hebasto commented at 5:34 AM on November 9, 2020: member

    ACK 5eea822eb37596c7f9ea73c62f8019414cfa281b, tested on Linux Mint 20 (x86_64).

    nit: Could be squashed.

  8. sipa deleted a comment on Nov 9, 2020
  9. swapped "is" for "==" in literal comparison
    update lint-python.sh to include check F632
    b6121edf70
  10. tylerchambers commented at 3:23 PM on November 9, 2020: contributor

    commits have been squashed

  11. practicalswift commented at 3:38 PM on November 9, 2020: contributor

    re-ACK b6121edf70a8d50fd16ddbba0c3168e5e49bfc2e: patch still looks correct

  12. hebasto approved
  13. hebasto commented at 4:24 PM on November 9, 2020: member

    re-ACK b6121edf70a8d50fd16ddbba0c3168e5e49bfc2e, only squashed since my previous review.

  14. theStack approved
  15. theStack commented at 12:36 PM on November 11, 2020: member

    utACK b6121edf70a8d50fd16ddbba0c3168e5e49bfc2e

  16. fanquake merged this on Nov 17, 2020
  17. fanquake closed this on Nov 17, 2020

  18. sidhujag referenced this in commit 4b71043e4f on Nov 17, 2020
  19. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me