Skip to content

Commit

Permalink
contrib: Fix SyntaxWarning in Python base58 implementation
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
moreati authored Jun 15, 2020
1 parent 1c86ed4 commit 47b49a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/testgen/base58.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 47b49a0

Please sign in to comment.