Skip to content

Commit 7d7a0ef

Browse files
committed
Fix for Python 3.10 and Python 10: don't compare to sys.version string
1 parent 7a24229 commit 7d7a0ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ecdsa/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
oid_ecPublicKey = (1, 2, 840, 10045, 2, 1)
1818
encoded_oid_ecPublicKey = der.encode_oid(*oid_ecPublicKey)
1919

20-
if sys.version > '3':
20+
if sys.version_info >= (3,):
2121
def entropy_to_bits(ent_256):
2222
"""Convert a bytestring to string of 0's and 1's"""
2323
return bin(int.from_bytes(ent_256, 'big'))[2:].zfill(len(ent_256)*8)
@@ -27,7 +27,7 @@ def entropy_to_bits(ent_256):
2727
return ''.join(bin(ord(x))[2:].zfill(8) for x in ent_256)
2828

2929

30-
if sys.version < '2.7':
30+
if sys.version_info < (2, 7):
3131
# Can't add a method to a built-in type so we are stuck with this
3232
def bit_length(x):
3333
return len(bin(x)) - 2

0 commit comments

Comments
 (0)