diff options
author | Alex Willmer <alex@moreati.org.uk> | 2020-06-15 21:36:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 21:36:54 +0100 |
commit | 47b49a05eafddcaef373f70436d794e9f9f7495c (patch) | |
tree | 47d7056bc239c39ae356724677cfe39cc15e0077 | |
parent | 1c86ed41483471929840eec09b93d7de3a4aeacf (diff) |
contrib: Fix SyntaxWarning in Python base58 implementation
In Python integers should be compared for equality (`i == j`), not identity (`i is j`). Recent versions of CPython 3.x emit a SyntaxWarning when they encounter this incorrect usage, e.g.
```
$ python3 base58.py
base58.py:110: SyntaxWarning: "is" with a literal. Did you mean "=="?
assert get_bcaddress_version('15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC') is 0
Tests passed
```
-rw-r--r-- | contrib/testgen/base58.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/testgen/base58.py b/contrib/testgen/base58.py index da67cb2d90..c7ebac50d4 100644 --- a/contrib/testgen/base58.py +++ b/contrib/testgen/base58.py @@ -107,7 +107,7 @@ def get_bcaddress_version(strAddress): if __name__ == '__main__': # Test case (from http://gitorious.org/bitcoin/python-base58.git) - assert get_bcaddress_version('15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC') is 0 + assert get_bcaddress_version('15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC') == 0 _ohai = 'o hai'.encode('ascii') _tmp = b58encode(_ohai) assert _tmp == 'DYB3oMS' |