[tor-commits] [stem/master] Fix x25519_supported AttributeError

atagar at torproject.org atagar at torproject.org
Mon Nov 18 00:02:11 UTC 2019


commit 95531abf2b88f97f881b73f61c037a21390388cd
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Nov 17 16:00:34 2019 -0800

    Fix x25519_supported AttributeError
    
    Oops, turns out the cryptography module doesn't always supply this method...
    
      Traceback (most recent call last):
        File "./run_tests.py", line 36, in <module>
          import test.runner
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/test/runner.py", line 44, in <module>
          import stem.connection
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/stem/connection.py", line 136, in <module>
          import stem.control
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/stem/control.py", line 271, in <module>
          import stem.descriptor.microdescriptor
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/stem/descriptor/__init__.py", line 1544, in <module>
          import stem.descriptor.hidden_service
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/stem/descriptor/hidden_service.py", line 81, in <module>
          X25519_AVAILABLE = backend.x25519_supported()
      AttributeError: 'Backend' object has no attribute 'x25519_supported'
---
 stem/descriptor/hidden_service.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/descriptor/hidden_service.py b/stem/descriptor/hidden_service.py
index 3ad2f031..0e710e7a 100644
--- a/stem/descriptor/hidden_service.py
+++ b/stem/descriptor/hidden_service.py
@@ -78,7 +78,7 @@ else:
 
 try:
   from cryptography.hazmat.backends.openssl.backend import backend
-  X25519_AVAILABLE = backend.x25519_supported()
+  X25519_AVAILABLE = hasattr(backend, 'x25519_supported') and backend.x25519_supported()
 except ImportError:
   X25519_AVAILABLE = False
 



More information about the tor-commits mailing list