D5721: sslutil: use raw strings for exception reason compare

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Jan 26 18:19:00 EST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG0d226b2139df: sslutil: use raw strings for exception reason compare (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5721?vs=13520&id=13528

REVISION DETAIL
  https://phab.mercurial-scm.org/D5721

AFFECTED FILES
  mercurial/sslutil.py

CHANGE DETAILS

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -430,14 +430,15 @@
                           'error)\n'))
         except ssl.SSLError:
             pass
+
         # Try to print more helpful error messages for known failures.
         if util.safehasattr(e, 'reason'):
             # This error occurs when the client and server don't share a
             # common/supported SSL/TLS protocol. We've disabled SSLv2 and SSLv3
             # outright. Hopefully the reason for this error is that we require
             # TLS 1.1+ and the server only supports TLS 1.0. Whatever the
             # reason, try to emit an actionable warning.
-            if e.reason == 'UNSUPPORTED_PROTOCOL':
+            if e.reason == r'UNSUPPORTED_PROTOCOL':
                 # We attempted TLS 1.0+.
                 if settings['protocolui'] == 'tls1.0':
                     # We support more than just TLS 1.0+. If this happens,
@@ -484,7 +485,7 @@
                         '(see https://mercurial-scm.org/wiki/SecureConnections '
                         'for more info)\n'))
 
-            elif (e.reason == 'CERTIFICATE_VERIFY_FAILED' and
+            elif (e.reason == r'CERTIFICATE_VERIFY_FAILED' and
                 pycompat.iswindows):
 
                 ui.warn(_('(the full certificate chain may not be available '



To: indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list