[tor-commits] [bridgedb/master] Fix GOOGLE_INTERNET_AUTHORITY_CA_CERT constant initialization

phw at torproject.org phw at torproject.org
Wed Feb 19 18:26:37 UTC 2020


commit f1a1dfe3b66f1857fcb6ce2f0291c88a2d6a7a72
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Jan 13 18:05:22 2020 -0800

    Fix GOOGLE_INTERNET_AUTHORITY_CA_CERT constant initialization
    
    Byte strings have always been initialized via b'msg'. Calling bytes() for this
    constant never made sense - in python 2.x it was a no-op, and in python 3.x it
    errors...
    
      Traceback (most recent call last):
        File "/usr/local/lib/python3.5/dist-packages/twisted/trial/runner.py", line 823, in loadByName
          return self.suiteFactory([self.findByName(name, recurse=recurse)])
        File "/usr/local/lib/python3.5/dist-packages/twisted/trial/runner.py", line 702, in findByName
          __import__(name)
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_txrecaptcha.py", line 31, in <module>
          from bridgedb import txrecaptcha
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/txrecaptcha.py", line 71, in <module>
          -----END CERTIFICATE-----"""))
      builtins.TypeError: string argument without an encoding
    
    This changes the test results as follows...
    
      before: FAILED (skips=106, failures=17, errors=256, successes=425)
      after:  FAILED (skips=109, failures=18, errors=386, successes=468)
---
 bridgedb/txrecaptcha.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bridgedb/txrecaptcha.py b/bridgedb/txrecaptcha.py
index 885b40d..26ead43 100644
--- a/bridgedb/txrecaptcha.py
+++ b/bridgedb/txrecaptcha.py
@@ -51,7 +51,7 @@ API_SSL_VERIFY_URL = "%s/verify" % API_SSL_SERVER
 
 #: (:class:`OpenSSL.crypto.X509`) Only trust certificate for the reCAPTCHA
 #: :data:`API_SSL_SERVER` which were signed by the Google Internet Authority CA.
-GOOGLE_INTERNET_AUTHORITY_CA_CERT = load_certificate(FILETYPE_PEM, bytes("""\
+GOOGLE_INTERNET_AUTHORITY_CA_CERT = load_certificate(FILETYPE_PEM, b"""\
 -----BEGIN CERTIFICATE-----
 MIICsDCCAhmgAwIBAgIDFXfhMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT
 MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0
@@ -68,7 +68,7 @@ Y3Jscy9zZWN1cmVjYS5jcmwwDQYJKoZIhvcNAQEFBQADgYEAvprjecFG+iJsxzEF
 ZUNgujFQodUovxOWZshcnDW7fZ7mTlk3zpeVJrGPZzhaDhvuJjIfKqHweFB7gwB+
 ARlIjNvrPq86fpVg0NOTawALkSqOUMl3MynBQO+spR7EHcRbADQ/JemfTEh2Ycfl
 vZqhEFBfurZkX0eTANq98ZvVfpg=
------END CERTIFICATE-----"""))
+-----END CERTIFICATE-----""")
 
 # `t.w.client.HTTPConnectionPool` isn't available in Twisted-12.0.0
 # (see ticket #11219: https://bugs.torproject.org/11219):





More information about the tor-commits mailing list