[tor-commits] [stem/master] Update to python 3.9

atagar at torproject.org atagar at torproject.org
Wed Oct 27 00:38:39 UTC 2021


commit 56f3daa4c124dae3e050b76d531480f8e233cc59
Author: Linus Gasser <linus.gasser at epfl.ch>
Date:   Fri Oct 22 10:12:06 2021 +0200

    Update to python 3.9
    
    Closes #105
    
    Since python 3.2: https://docs.python.org/3/library/stdtypes.html#int.from_bytes
---
 stem/descriptor/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index 3f10bc57..c015d246 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -1051,7 +1051,7 @@ class Descriptor(object):
     try:
       from cryptography.hazmat.backends import default_backend
       from cryptography.hazmat.primitives.serialization import load_der_public_key
-      from cryptography.utils import int_to_bytes, int_from_bytes
+      from cryptography.utils import int_to_bytes
     except ImportError:
       raise ValueError('Generating the signed digest requires the cryptography module')
 
@@ -1060,7 +1060,7 @@ class Descriptor(object):
     public_exponent = key.public_numbers().e
 
     sig_as_bytes = _bytes_for_block(signature)
-    sig_as_long = int_from_bytes(sig_as_bytes, byteorder='big')  # convert signature to an int
+    sig_as_long = int.from_bytes(sig_as_bytes, byteorder='big')  # convert signature to an int
     blocksize = len(sig_as_bytes)  # 256B for NetworkStatusDocuments, 128B for others
 
     # use the public exponent[e] & the modulus[n] to decrypt the int



More information about the tor-commits mailing list